Browse Source

headers: add new file dictionary.h with declarations of functions in dictionary.c

master
Juho Hiltunen 7 years ago
parent
commit
231a1d0944

+ 1
- 0
src/libespeak-ng/compiledict.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "dictionary.h"
#include "readclause.h" #include "readclause.h"


#include "error.h" #include "error.h"

+ 3
- 2
src/libespeak-ng/dictionary.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "dictionary.h"
#include "numbers.h"
#include "readclause.h" #include "readclause.h"
#include "synthdata.h" #include "synthdata.h"
#include "numbers.h"


#include "speech.h" #include "speech.h"
#include "phoneme.h" #include "phoneme.h"
} }
#pragma GCC visibility pop #pragma GCC visibility pop


int Reverse4Bytes(int word)
static int Reverse4Bytes(int word)
{ {
// reverse the order of bytes from little-endian to big-endian // reverse the order of bytes from little-endian to big-endian
#ifdef ARCH_BIG #ifdef ARCH_BIG

+ 56
- 0
src/libespeak-ng/dictionary.h View File

/*
* Copyright (C) 2005 to 2015 by Jonathan Duddington
* email: [email protected]
* Copyright (C) 2015-2018 Reece H. Dunn
* Copyright (C) 2018 Juho Hiltunen
*
* 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_DICTIONARY_H
#define ESPEAK_NG_DICTIONARY_H

#include "synthesize.h"
#include "translate.h"

#ifdef __cplusplus
extern "C"
{
#endif

void strncpy0(char *to, const char *from, int size);
int LoadDictionary(Translator *tr, const char *name, int no_error);
int HashDictionary(const char *string);
const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme);
void DecodePhonemes(const char *inptr, char *outptr);
char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa, int *flags);
const char *GetTranslatedPhonemeString(int phoneme_mode);
int IsVowel(Translator *tr, int letter);
int Unpronouncable(Translator *tr, char *word, int posn);
void ChangeWordStress(Translator *tr, char *word, int new_stress);
void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int control);
void AppendPhonemes(Translator *tr, char *string, int size, const char *ph);
int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, char *end_phonemes, int word_flags, unsigned int *dict_flags);
int TransposeAlphabet(Translator *tr, char *text);
int Lookup(Translator *tr, const char *word, char *ph_out);
int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *flags, int end_flags, WORD_TAB *wtab);
int LookupFlags(Translator *tr, const char *word, unsigned int **flags_out);
int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy);

#ifdef __cplusplus
}
#endif

#endif


+ 2
- 1
src/libespeak-ng/numbers.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "readclause.h"
#include "dictionary.h"
#include "numbers.h" #include "numbers.h"
#include "readclause.h"


#include "phoneme.h" #include "phoneme.h"
#include "voice.h" #include "voice.h"

+ 0
- 3
src/libespeak-ng/phoneme.h View File

int LookupPhonemeString(const char *string); int LookupPhonemeString(const char *string);
int PhonemeCode(unsigned int mnem); int PhonemeCode(unsigned int mnem);


const char *EncodePhonemes(const char *p, char *outptr, int *bad_phoneme);
void DecodePhonemes(const char *inptr, char *outptr);

extern const char *WordToString(unsigned int word); extern const char *WordToString(unsigned int word);


extern PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS]; extern PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS];

+ 1
- 0
src/libespeak-ng/readclause.c View File

#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>
#include <ucd/ucd.h> #include <ucd/ucd.h>


#include "dictionary.h"
#include "readclause.h" #include "readclause.h"


#include "error.h" #include "error.h"

+ 1
- 0
src/libespeak-ng/speech.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "dictionary.h"
#include "readclause.h" #include "readclause.h"


#include "speech.h" #include "speech.h"

+ 1
- 0
src/libespeak-ng/synth_mbrola.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "dictionary.h"
#include "readclause.h" #include "readclause.h"
#include "synthdata.h" #include "synthdata.h"



+ 1
- 0
src/libespeak-ng/synthesize.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "dictionary.h"
#include "intonation.h" #include "intonation.h"
#include "setlengths.h" #include "setlengths.h"
#include "synthdata.h" #include "synthdata.h"

+ 0
- 1
src/libespeak-ng/synthesize.h View File

int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which); int FormantTransition2(frameref_t *seq, int *n_frames, unsigned int data1, unsigned int data2, PHONEME_TAB *other_ph, int which);


void Write4Bytes(FILE *f, int value); void Write4Bytes(FILE *f, int value);
int Reverse4Bytes(int word);


#if HAVE_SONIC_H #if HAVE_SONIC_H
void DoSonicSpeed(int value); void DoSonicSpeed(int value);

+ 3
- 2
src/libespeak-ng/translate.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "readclause.h"
#include "phonemelist.h"
#include "dictionary.h"
#include "numbers.h" #include "numbers.h"
#include "phonemelist.h"
#include "readclause.h"


#include "speech.h" #include "speech.h"
#include "phoneme.h" #include "phoneme.h"

+ 0
- 17
src/libespeak-ng/translate.h View File

extern void SetLengthMods(Translator *tr, int value); extern void SetLengthMods(Translator *tr, int value);


void LoadConfig(void); void LoadConfig(void);
int TransposeAlphabet(Translator *tr, char *text);


#define LEADING_2_BITS 0xC0 // 0b11000000 #define LEADING_2_BITS 0xC0 // 0b11000000
#define UTF8_TAIL_BITS 0x80 // 0b10000000 #define UTF8_TAIL_BITS 0x80 // 0b10000000
int IsDigit(unsigned int c); int IsDigit(unsigned int c);
int IsDigit09(unsigned int c); int IsDigit09(unsigned int c);
int IsAlpha(unsigned int c); int IsAlpha(unsigned int c);
int IsVowel(Translator *tr, int c);
int isspace2(unsigned int c); int isspace2(unsigned int c);
const char *GetTranslatedPhonemeString(int phoneme_mode);
ALPHABET *AlphabetFromChar(int c); ALPHABET *AlphabetFromChar(int c);


Translator *SelectTranslator(const char *name); Translator *SelectTranslator(const char *name);
int SetTranslator2(const char *name); int SetTranslator2(const char *name);
void DeleteTranslator(Translator *tr); void DeleteTranslator(Translator *tr);
void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts); void ProcessLanguageOptions(LANGUAGE_OPTIONS *langopts);
int Lookup(Translator *tr, const char *word, char *ph_out);
int LookupFlags(Translator *tr, const char *word, unsigned int **flags_out);

void ChangeWordStress(Translator *tr, char *word, int new_stress);

int LoadDictionary(Translator *tr, const char *name, int no_error);
int LookupDictList(Translator *tr, char **wordptr, char *ph_out, unsigned int *flags, int end_flags, WORD_TAB *wtab);
int HashDictionary(const char *string);


void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len); void print_dictionary_flags(unsigned int *flags, char *buf, int buf_len);
char *DecodeRule(const char *group_chars, int group_length, char *rule, int control); char *DecodeRule(const char *group_chars, int group_length, char *rule, int control);


void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags); void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flags);
void AppendPhonemes(Translator *tr, char *string, int size, const char *ph);


int RemoveEnding(Translator *tr, char *word, int end_type, char *word_copy);
int Unpronouncable(Translator *tr, char *word, int posn);
void SetWordStress(Translator *tr, char *output, unsigned int *dictionary_flags, int tonic, int prev_stress);
int TranslateRules(Translator *tr, char *p, char *phonemes, int size, char *end_phonemes, int end_flags, unsigned int *dict_flags);
int TranslateWord(Translator *tr, char *word1, WORD_TAB *wtab, char *word_out); int TranslateWord(Translator *tr, char *word1, WORD_TAB *wtab, char *word_out);
void TranslateClause(Translator *tr, int *tone, char **voice_change); void TranslateClause(Translator *tr, int *tone, char **voice_change);


void SetVoiceStack(espeak_VOICE *v, const char *variant_name); void SetVoiceStack(espeak_VOICE *v, const char *variant_name);
char *WritePhMnemonic(char *phon_out, PHONEME_TAB *ph, PHONEME_LIST *plist, int use_ipa, int *flags);


extern FILE *f_trans; // for logging extern FILE *f_trans; // for logging



+ 1
- 0
src/libespeak-ng/voices.c View File

#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>
#include <espeak-ng/encoding.h> #include <espeak-ng/encoding.h>


#include "dictionary.h"
#include "readclause.h" #include "readclause.h"


#include "speech.h" #include "speech.h"

Loading…
Cancel
Save