1 /***************************************************************************
2  *  Copyright 1991, 1992, 1993, 1994, 1995, 1996, 2001, 2002               *
3  *    David R. Hill, Leonard Manzara, Craig Schock                         *
4  *                                                                         *
5  *  This program is free software: you can redistribute it and/or modify   *
6  *  it under the terms of the GNU General Public License as published by   *
7  *  the Free Software Foundation, either version 3 of the License, or      *
8  *  (at your option) any later version.                                    *
9  *                                                                         *
10  *  This program is distributed in the hope that it will be useful,        *
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
13  *  GNU General Public License for more details.                           *
14  *                                                                         *
15  *  You should have received a copy of the GNU General Public License      *
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
17  ***************************************************************************/
18 // 2014-09
19 // This file was copied from Gnuspeech and modified by Marcelo Y. Matuda.
20 
21 #include "en/letter_to_sound/suffix.h"
22 
23 #include "en/letter_to_sound/ends_with.h"
24 #include "en/letter_to_sound/vowel_before.h"
25 
26 
27 
28 namespace GS {
29 namespace En {
30 
31 /******************************************************************************
32 *
33 *	function:	suffix
34 *
35 *	purpose:	Find suffix if vowel in word before the suffix.
36 *                       Return 0 if failed, or pointer to character which
37 *			preceeds the suffix.
38 *
39 *       arguments:      in, end, suflist
40 *
41 *	internal
42 *	functions:	ends_with, vowel_before
43 *
44 *	library
45 *	functions:	none
46 *
47 ******************************************************************************/
48 const char*
suffix(const char * in,const char * end,const char * suflist)49 suffix(const char* in, const char* end, const char* suflist)
50 {
51 	const char* temp = ends_with(in, end, suflist);
52 	if (temp && vowel_before(in, temp + 1))
53 		return temp;
54 	return nullptr;
55 }
56 
57 } /* namespace En */
58 } /* namespace GS */
59