#include "config.h" | #include "config.h" | ||||
#include <stdint.h> | |||||
#include <stdlib.h> | |||||
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "encoding.h" | |||||
// http://www.iana.org/assignments/character-sets/character-sets.xhtml | // http://www.iana.org/assignments/character-sets/character-sets.xhtml | ||||
MNEM_TAB mnem_encoding[] = { | MNEM_TAB mnem_encoding[] = { | ||||
} | } | ||||
#pragma GCC visibility pop | #pragma GCC visibility pop | ||||
struct espeak_ng_TEXT_DECODER_ | |||||
{ | |||||
}; | |||||
espeak_ng_TEXT_DECODER * | |||||
create_text_decoder(void) | |||||
{ | |||||
espeak_ng_TEXT_DECODER *decoder = malloc(sizeof(espeak_ng_TEXT_DECODER)); | |||||
if (!decoder) return NULL; | |||||
return decoder; | |||||
} | |||||
void | |||||
destroy_text_decoder(espeak_ng_TEXT_DECODER *decoder) | |||||
{ | |||||
if (decoder) free(decoder); | |||||
} | |||||
int | |||||
text_decoder_eof(espeak_ng_TEXT_DECODER *decoder) | |||||
{ | |||||
return 1; | |||||
} | |||||
uint32_t | |||||
text_decoder_getc(espeak_ng_TEXT_DECODER *decoder) | |||||
{ | |||||
return 0; | |||||
} |
/* | |||||
* Copyright (C) 2017 Reece H. Dunn | |||||
* | |||||
* 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 3 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, see: <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef ESPEAK_NG_ENCODING_H | |||||
#define ESPEAK_NG_ENCODING_H | |||||
#ifdef __cplusplus | |||||
extern "C" | |||||
{ | |||||
#endif | |||||
typedef struct espeak_ng_TEXT_DECODER_ espeak_ng_TEXT_DECODER; | |||||
espeak_ng_TEXT_DECODER * | |||||
create_text_decoder(void); | |||||
void | |||||
destroy_text_decoder(espeak_ng_TEXT_DECODER *decoder); | |||||
int | |||||
text_decoder_eof(espeak_ng_TEXT_DECODER *decoder); | |||||
uint32_t | |||||
text_decoder_getc(espeak_ng_TEXT_DECODER *decoder); | |||||
#ifdef __cplusplus | |||||
} | |||||
#endif | |||||
#endif |
#include "config.h" | #include "config.h" | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <stdint.h> | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <espeak-ng/espeak_ng.h> | #include <espeak-ng/espeak_ng.h> | ||||
#include "encoding.h" | |||||
void | |||||
test_unbound_text_decoder() | |||||
{ | |||||
printf("testing unbound text decoder\n"); | |||||
espeak_ng_TEXT_DECODER *decoder = create_text_decoder(); | |||||
assert(decoder != NULL); | |||||
assert(text_decoder_eof(decoder) == 1); | |||||
assert(text_decoder_getc(decoder) == 0); | |||||
destroy_text_decoder(decoder); | |||||
} | |||||
void | void | ||||
test_unknown_encoding() | test_unknown_encoding() | ||||
int | int | ||||
main(int argc, char **argv) | main(int argc, char **argv) | ||||
{ | { | ||||
test_unbound_text_decoder(); | |||||
test_unknown_encoding(); | test_unknown_encoding(); | ||||
test_us_ascii_encoding(); | test_us_ascii_encoding(); | ||||
printf("done\n"); | printf("done\n"); |