| 1 |
/* |
| 2 |
* Copyright (C) 2005 to 2014 by Jonathan Duddington |
| 3 |
* email: [email protected] |
| 4 |
* Copyright (C) 2013-2017 Reece H. Dunn |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation; either version 3 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, see: <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include "espeak__config.h" |
| 21 |
|
| 22 |
#include <string.h> |
| 23 |
|
| 24 |
#include "espeak_ng.h" |
| 25 |
|
| 26 |
#include "mnemonics.h" // for MNEM_TAB, LookupMnem, LookupMnemName |
| 27 |
|
| 28 |
int LookupMnem(const MNEM_TAB *table, const char *string) |
| 29 |
{ |
| 30 |
while (table->mnem != NULL) { |
| 31 |
if (string && strcmp(string, table->mnem) == 0) |
| 32 |
return table->value; |
| 33 |
table++; |
| 34 |
} |
| 35 |
return table->value; |
| 36 |
} |
| 37 |
|
| 38 |
const char *LookupMnemName(const MNEM_TAB *table, const int value) |
| 39 |
{ |
| 40 |
while (table->mnem != NULL) { |
| 41 |
if (table->value == value) |
| 42 |
return table->mnem; |
| 43 |
table++; |
| 44 |
} |
| 45 |
return ""; // not found |
| 46 |
} |