1 /*************************************************************************/
2 /*                                                                       */
3 /*                Centre for Speech Technology Research                  */
4 /*                 (University of Edinburgh, UK) and                     */
5 /*                           Korin Richmond                              */
6 /*                         Copyright (c) 2003                            */
7 /*                         All Rights Reserved.                          */
8 /*                                                                       */
9 /*  Permission is hereby granted, free of charge, to use and distribute  */
10 /*  this software and its documentation without restriction, including   */
11 /*  without limitation the rights to use, copy, modify, merge, publish,  */
12 /*  distribute, sublicense, and/or sell copies of this work, and to      */
13 /*  permit persons to whom this work is furnished to do so, subject to   */
14 /*  the following conditions:                                            */
15 /*                                                                       */
16 /*   1. The code must retain the above copyright notice, this list of    */
17 /*      conditions and the following disclaimer.                         */
18 /*   2. Any modifications must be clearly marked as such.                */
19 /*   3. Original authors' names are not deleted.                         */
20 /*   4. The authors' names are not used to endorse or promote products   */
21 /*      derived from this software without specific prior written        */
22 /*      permission.                                                      */
23 /*                                                                       */
24 /*  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        */
25 /*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      */
26 /*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT   */
27 /*  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     */
28 /*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    */
29 /*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   */
30 /*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          */
31 /*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       */
32 /*  THIS SOFTWARE.                                                       */
33 /*                                                                       */
34 /*************************************************************************/
35 /*                       Author :  Korin Richmond                        */
36 /*                       Date   :  07 May 2003                           */
37 /* --------------------------------------------------------------------- */
38 /*                                                                       */
39 /* How to deal with EST errors with script interfaces built with SWIG    */
40 /*                                                                       */
41 /*************************************************************************/
42 
43 %{
44 #include "EST_error.h"
45 %}
46 
47 %include "exception.i"
48 
49 %define CATCH_EST_ERROR
50 {
51   char *p=EST_error_message;
52 
CATCH_ERRORS()53   CATCH_ERRORS()
54     {
55       SWIG_exception(SWIG_RuntimeError, p);
56     }
57   $action
58   END_CATCH_ERRORS();
59 }
60 %enddef
61