mnemonics.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2005 to 2014 by Jonathan Duddington
  3. * email: jonsd@users.sourceforge.net
  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. #include "config.h"
  20. #include <string.h>
  21. #include "espeak_ng.h"
  22. #include "speech.h"
  23. int LookupMnem(MNEM_TAB *table, const char *string)
  24. {
  25. while (table->mnem != NULL) {
  26. if (string && strcmp(string, table->mnem) == 0)
  27. return table->value;
  28. table++;
  29. }
  30. return table->value;
  31. }
  32. const char *LookupMnemName(MNEM_TAB *table, const int value)
  33. {
  34. while (table->mnem != NULL) {
  35. if (table->value == value)
  36. return table->mnem;
  37. table++;
  38. }
  39. return ""; // not found
  40. }