Browse Source

code cleanup: Check all local includes with include-what-you-use

Going through files in src/libespeak-ng/, include-what-you-use removed a
few unnecessary includes and included explanations on why a certain
header should be included. This makes tracking globals and dependencies easier.

Running the codebase through IWYU should be repeated after each major
code restIncludes to standard c library weren't checked to avoid
breaking builds with other platforms.

See https://github.com/include-what-you-use/include-what-you-use
master
Juho Hiltunen 5 years ago
parent
commit
ee944700f8

+ 11
- 11
src/libespeak-ng/compiledata.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" // for strncpy0
#include "synthdata.h" #include "error.h" // for create_file_error_context
#include "wavegen.h" #include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST
#include "readclause.h" // for Read4Bytes
#include "error.h" #include "spect.h" // for SpectFrame, peak_t, SpectSeq
#include "phoneme.h" #include "speech.h" // for path_home, MNEM_TAB, GetFileLength
#include "voice.h" #include "synthdata.h" // for LoadPhData
#include "synthesize.h" #include "synthesize.h" // for TUNE, frame_t, CONDITION_IS_OTHER
#include "spect.h" #include "translate.h" // for utf8_out, utf8_in
#include "translate.h" #include "voice.h" // for LoadVoice, voice
#include "dictionary.h" #include "wavegen.h" // for WavegenInit, WavegenSetVoice


#define N_ITEM_STRING 256 #define N_ITEM_STRING 256



+ 7
- 6
src/libespeak-ng/compiledict.c View File

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


#include "error.h" #include "dictionary.h" // for EncodePhonemes, strncpy0, HashDicti...
#include "speech.h" #include "error.h" // for create_file_error_context
#include "phoneme.h" #include "phoneme.h" // for PHONEME_TAB_LIST, phonSWITCH, phone...
#include "voice.h" #include "readclause.h" // for towlower2
#include "synthesize.h" #include "speech.h" // for LookupMnemName, MNEM_TAB, path_home
#include "translate.h" #include "synthesize.h" // for Write4Bytes
#include "translate.h" // for isspace2, IsDigit09, utf8_in, utf8_out


static FILE *f_log = NULL; static FILE *f_log = NULL;



+ 5
- 5
src/libespeak-ng/compilembrola.c View File



#include "mbrola.h" #include "mbrola.h"


#include "error.h" #include "error.h" // for create_file_error_context
#include "phoneme.h" #include "mbrola.h" // for MBROLA_TAB
#include "speech.h" #include "phoneme.h" // for N_PHONEME_TAB
#include "voice.h" #include "speech.h" // for path_home
#include "synthesize.h" #include "synthesize.h" // for Write4Bytes


static const char *basename(const char *filename) static const char *basename(const char *filename)
{ {

+ 8
- 9
src/libespeak-ng/dictionary.c View File

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


#include "dictionary.h" #include "dictionary.h"
#include "numbers.h" #include "numbers.h" // for LookupAccentedLetter, Look...
#include "readclause.h" #include "phoneme.h" // for PHONEME_TAB, phVOWEL, phon...
#include "synthdata.h" #include "readclause.h" // for WordToString2, is_str_tota...

#include "speech.h" // for GetFileLength, path_home
#include "speech.h" #include "compiledict.h" // for DecodeRule
#include "phoneme.h" #include "synthdata.h" // for PhonemeCode, InterpretPhoneme
#include "voice.h" #include "synthesize.h" // for STRESS_IS_PRIMARY, phoneme...
#include "synthesize.h" #include "translate.h" // for Translator, utf8_in, LANGU...
#include "translate.h"


typedef struct { typedef struct {
int points; int points;

+ 4
- 3
src/libespeak-ng/dictionary.h View File

#ifndef ESPEAK_NG_DICTIONARY_H #ifndef ESPEAK_NG_DICTIONARY_H
#define ESPEAK_NG_DICTIONARY_H #define ESPEAK_NG_DICTIONARY_H


#include "compiledict.h" #include "espeak-ng/espeak_ng.h" // for ESPEAK_NG_API
#include "synthesize.h" #include "phoneme.h" // for PHONEME_TAB
#include "translate.h" #include "synthesize.h" // for PHONEME_LIST
#include "translate.h" // for Translator, WORD_TAB


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

+ 4
- 5
src/libespeak-ng/encoding.c View File

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


#include "speech.h" #include <espeak-ng/encoding.h> // for espeak_ng_TEXT_DECODER, ESPEAKNG_EN...
#include "phoneme.h" #include "espeak-ng/speak_lib.h" // for espeakCHARS_16BIT, espeakCHARS_8BIT
#include "voice.h" #include "speech.h" // for LookupMnem, MNEM_TAB
#include "synthesize.h" #include "translate.h" // for LEADING_2_BITS, UTF8_TAIL_BITS
#include "translate.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[] = {

+ 1
- 5
src/libespeak-ng/error.c View File

#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h>


#include "error.h" #include "error.h"
#include "speech.h" #include "dictionary.h" // for strncpy0
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "dictionary.h"


espeak_ng_STATUS espeak_ng_STATUS
create_file_error_context(espeak_ng_ERROR_CONTEXT *context, create_file_error_context(espeak_ng_ERROR_CONTEXT *context,

+ 2
- 5
src/libespeak-ng/espeak_api.c View File



#include "compiledict.h" #include "compiledict.h"


#include "phoneme.h" #include "synthesize.h" // for espeakINITIALIZE_PHONEME_IPA
#include "voice.h" #include "translate.h" // for dictionary_name, option_phoneme_events
#include "synthesize.h"
#include "translate.h"
#include "event.h"


static espeak_ERROR status_to_espeak_error(espeak_ng_STATUS status) static espeak_ERROR status_to_espeak_error(espeak_ng_STATUS status)
{ {

+ 4
- 6
src/libespeak-ng/intonation.c View File

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


#include "intonation.h" #include "intonation.h"
#include "synthdata.h" #include "phoneme.h" // for PHONEME_TAB, PhonemeCode2, phonPAUSE, phPAUSE

#include "synthdata.h" // for PhonemeCode
#include "phoneme.h" #include "synthesize.h" // for PHONEME_LIST, TUNE, phoneme_list, phoneme_tab
#include "voice.h" #include "translate.h" // for Translator, LANGUAGE_OPTIONS, L, OPTION_EMPH...
#include "synthesize.h"
#include "translate.h"


/* Note this module is mostly old code that needs to be rewritten to /* Note this module is mostly old code that needs to be rewritten to
provide a more flexible intonation system. provide a more flexible intonation system.

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

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


#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "klatt.h" #include "klatt.h"
#include "synthesize.h" // for frame_t, WGEN_DATA, STEPSIZE, N_KLATTP, echo...
#include "voice.h" // for voice_t, N_PEAKS


extern unsigned char *out_ptr; extern unsigned char *out_ptr;
extern unsigned char *out_end; extern unsigned char *out_end;

+ 2
- 2
src/libespeak-ng/klatt.h View File

#ifndef ESPEAK_NG_KLATT_H #ifndef ESPEAK_NG_KLATT_H
#define ESPEAK_NG_KLATT_H #define ESPEAK_NG_KLATT_H


#include "speech.h" #include "voice.h" // for voice_t
#include "synthesize.h" #include "synthesize.h" // for frame_t, WGEN_DATA


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

+ 1
- 1
src/libespeak-ng/mnemonics.c View File



#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h>


#include "speech.h" #include "speech.h" // for MNEM_TAB, LookupMnem, LookupMnemName


int LookupMnem(MNEM_TAB *table, const char *string) int LookupMnem(MNEM_TAB *table, const char *string)
{ {

+ 7
- 8
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 "dictionary.h"
#include "numbers.h" #include "numbers.h"
#include "readclause.h" #include "dictionary.h" // for Lookup, TranslateRules, EncodePhonemes, Look...
#include "synthdata.h" #include "phoneme.h" // for phonSWITCH, PHONEME_TAB, phonEND_WORD, phonP...
#include "readclause.h" // for WordToString2, towlower2
#include "phoneme.h" #include "synthdata.h" // for SelectPhonemeTable
#include "voice.h" #include "synthesize.h" // for phoneme_tab
#include "synthesize.h" #include "translate.h" // for Translator, LANGUAGE_OPTIONS, IsDigit09, WOR...
#include "translate.h" #include "voice.h" // for voice, voice_t


#define M_LIGATURE 0x8000 #define M_LIGATURE 0x8000
#define M_NAME 0 #define M_NAME 0

+ 4
- 2
src/libespeak-ng/phonemelist.c View File

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


#include "phonemelist.h" #include "phonemelist.h"
#include "synthdata.h" #include "phoneme.h" // for PHONEME_TAB, phVOWEL, REPLACE_PHONEMES, phPAUSE
#include "synthdata.h" // for InterpretPhoneme, SelectPhonemeTable
#include "synthesize.h" // for PHONEME_LIST, PHONEME_LIST2, phoneme_tab
#include "translate.h" // for Translator, LANGUAGE_OPTIONS, option_wordgap


#include "phoneme.h" #include "phoneme.h"
#include "voice.h"
#include "synthesize.h" #include "synthesize.h"
#include "translate.h" #include "translate.h"



+ 10
- 10
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 "synthdata.h" #include "config.h" // for HAVE_MKSTEMP

#include "dictionary.h" // for LookupDictList, DecodePhonemes, Set...
#include "error.h" #include "error.h" // for create_file_error_context
#include "speech.h" #include "phoneme.h" // for phonSWITCH
#include "phoneme.h" #include "speech.h" // for GetFileLength, LookupMnem, PATHSEP
#include "voice.h" #include "ssml.h" // for SSML_STACK, ProcessSsmlTag, N_PARAM...
#include "synthesize.h" #include "synthdata.h" // for SelectPhonemeTable
#include "translate.h" #include "synthesize.h" // for SOUND_ICON, soundicon_tab, samplerate
#include "ssml.h" #include "translate.h" // for Translator, utf8_out, CLAUSE_OPTION...
#include "voice.h" // for voice, voice_t, current_voice_selected


#define N_XML_BUF 500 #define N_XML_BUF 500



+ 4
- 4
src/libespeak-ng/spect.c View File

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


#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "spect.h" #include "spect.h"
#include "ieee80.h" #include "ieee80.h" // for ConvertFromIeeeExtended
#include "wavegen.h" // for wavegen_peaks_t, PeaksToHarmspect
#include "synthesize.h" // for KLATT_AV, KLATT_Kopen, N_KLATTP2
#include "voice.h" // for N_PEAKS


static int frame_width; static int frame_width;



+ 3
- 6
src/libespeak-ng/spect.h View File

#ifndef ESPEAK_NG_SPECT_H #ifndef ESPEAK_NG_SPECT_H
#define ESPEAK_NG_SPECT_H #define ESPEAK_NG_SPECT_H


#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h> // for espeak_ng_STATUS

#include "voice.h" // for N_PEAKS
#include "wavegen.h" #include "synthesize.h" // for N_KLATTP2

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


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

+ 11
- 13
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 "mbrola.h"
#include "readclause.h"
#include "synthdata.h"
#include "wavegen.h"

#include "speech.h" #include "speech.h"
#include "phoneme.h" #include "dictionary.h" // for GetTranslatedPhonemeString, strncpy0
#include "voice.h" #include "espeak_command.h" // for delete_espeak_command, SetParameter
#include "synthesize.h" #include "event.h" // for event_declare, event_clear_all, eve...
#include "translate.h" #include "fifo.h" // for fifo_add_command, fifo_add_commands
#include "espeak_command.h" #include "mbrola.h" // for mbrola_delay
#include "fifo.h" #include "readclause.h" // for PARAM_STACK, param_stack
#include "event.h" #include "synthdata.h" // for FreePhData, LoadConfig, LoadPhData
#include "synthesize.h" // for SpeakNextClause, Generate, Synthesi...
#include "translate.h" // for p_decoder, InitText, translator
#include "voice.h" // for FreeVoiceList, VoiceReset, current_...
#include "wavegen.h" // for WavegenFill, WavegenInit, WcmdqUsed


unsigned char *outbuf = NULL; unsigned char *outbuf = NULL;
int outbuf_size = 0; int outbuf_size = 0;

+ 1
- 1
src/libespeak-ng/speech.h View File

#ifndef ESPEAK_NG_SPEECH_H #ifndef ESPEAK_NG_SPEECH_H
#define ESPEAK_NG_SPEECH_H #define ESPEAK_NG_SPEECH_H


#include <endian.h> // for BYTE_ORDER, BIG_ENDIAN
#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h>


#include "mbrola.h"


#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"

+ 6
- 9
src/libespeak-ng/ssml.c View File

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


#include "readclause.h"

#include "error.h"
#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h"
#include "dictionary.h"
#include "ssml.h" #include "ssml.h"
#include "dictionary.h" // for strncpy0
#include "readclause.h" // for PARAM_STACK, param_stack, AddNameData
#include "speech.h" // for MNEM_TAB, LookupMnem
#include "synthesize.h" // for SPEED_FACTORS, speed
#include "translate.h" // for CTRL_EMBEDDED, IsDigit09, utf8_out
#include "voice.h" // for SelectVoice, SelectVoiceByName


static MNEM_TAB ssmltags[] = { static MNEM_TAB ssmltags[] = {
{ "speak", SSML_SPEAK }, { "speak", SSML_SPEAK },

+ 7
- 8
src/libespeak-ng/synthdata.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 "synthdata.h" #include "synthdata.h"
#include "error.h" // for create_file_error_context, crea...
#include "error.h" #include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST
#include "speech.h" #include "speech.h" // for path_home, GetFileLength, PATHSEP
#include "phoneme.h" #include "mbrola.h" // for mbrola_name
#include "voice.h" #include "synthesize.h" // for PHONEME_LIST, frameref_t, PHONE...
#include "synthesize.h" #include "translate.h" // for Translator, LANGUAGE_OPTIONS
#include "translate.h" #include "voice.h" // for ReadTonePoints, tone_points, voice


const int version_phdata = 0x014801; const int version_phdata = 0x014801;



+ 5
- 3
src/libespeak-ng/synthdata.h View File

#ifndef ESPEAK_NG_SYNTHDATA_H #ifndef ESPEAK_NG_SYNTHDATA_H
#define ESPEAK_NG_SYNTHDATA_H #define ESPEAK_NG_SYNTHDATA_H


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

#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {
#endif #endif


#include "espeak-ng/espeak_ng.h" // for espeak_ng_ERROR_CONTEXT, espea...
#include "phoneme.h" // for PHONEME_TAB
#include "synthesize.h" // for PHONEME_DATA, PHONEME_LIST
#include "translate.h" // for Translator

void InterpretPhoneme(Translator *tr, void InterpretPhoneme(Translator *tr,
int control, int control,
PHONEME_LIST *plist, PHONEME_LIST *plist,

+ 9
- 10
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 "mbrola.h"
#include "setlengths.h"
#include "synthdata.h"
#include "wavegen.h"

#include "phoneme.h"
#include "voice.h"
#include "synthesize.h" #include "synthesize.h"
#include "translate.h" #include "dictionary.h" // for WritePhMnemonic, GetTranslatedPhone...
#include "intonation.h" // for CalcPitches
#include "mbrola.h" // for MbrolaGenerate, mbrola_name
#include "phoneme.h" // for PHONEME_TAB, phVOWEL, phLIQUID, phN...
#include "setlengths.h" // for CalcLengths
#include "synthdata.h" // for InterpretPhoneme, GetEnvelope, Inte...
#include "translate.h" // for translator, LANGUAGE_OPTIONS, Trans...
#include "voice.h" // for voice_t, voice, LoadVoiceVariant
#include "wavegen.h" // for WcmdqInc, WcmdqFree, WcmdqStop


static void SmoothSpect(void); static void SmoothSpect(void);



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

#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h>
#include "phoneme.h" #include "phoneme.h" // for PHONEME_TAB, N_PHONEME_TAB
#include "voice.h"


#define espeakINITIALIZE_PHONEME_IPA 0x0002 // move this to speak_lib.h, after eSpeak version 1.46.02 #define espeakINITIALIZE_PHONEME_IPA 0x0002 // move this to speak_lib.h, after eSpeak version 1.46.02



+ 1
- 4
src/libespeak-ng/tr_languages.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 "phoneme.h" #include "translate.h" // for Translator, LANGUAGE_OPTIONS, L, NUM...
#include "voice.h"
#include "synthesize.h"
#include "translate.h"


// start of unicode pages for character sets // start of unicode pages for character sets
#define OFFSET_GREEK 0x380 #define OFFSET_GREEK 0x380

+ 9
- 10
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 "dictionary.h"
#include "numbers.h"
#include "phonemelist.h"
#include "readclause.h"
#include "synthdata.h"

#include "speech.h"
#include "phoneme.h"
#include "voice.h"
#include "synthesize.h"
#include "translate.h" #include "translate.h"
#include "dictionary.h" // for TranslateRules, LookupDictList, Cha...
#include "numbers.h" // for SetSpellingStress, TranslateLetter
#include "phoneme.h" // for phonSWITCH, PHONEME_TAB, phonPAUSE_...
#include "phonemelist.h" // for MakePhonemeList
#include "readclause.h" // for towlower2, Eof, ReadClause, is_str_...
#include "synthdata.h" // for SelectPhonemeTable, LookupPhonemeTable
#include "synthesize.h" // for PHONEME_LIST2, N_PHONEME_LIST, PHON...
#include "ucd/ucd.h" // for ucd_toupper
#include "voice.h" // for voice, voice_t


Translator *translator = NULL; // the main translator Translator *translator = NULL; // the main translator
Translator *translator2 = NULL; // secondary translator for certain words Translator *translator2 = NULL; // secondary translator for certain words

+ 9
- 10
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 "voice.h" // for voice_t, DoVoiceChange, N_PEAKS
#include "readclause.h" #include "dictionary.h" // for strncpy0, LoadDictionary
#include "synthdata.h" #include "phoneme.h" // for REPLACE_PHONEMES, n_replace_pho...
#include "wavegen.h" #include "speech.h" // for LookupMnem, GetFileLength, PATHSEP

#include "mbrola.h" // for LoadMbrolaTable
#include "speech.h" #include "synthdata.h" // for SelectPhonemeTableName, LookupP...
#include "phoneme.h" #include "synthesize.h" // for SetSpeed, SPEED_FACTORS, speed
#include "voice.h" #include "translate.h" // for LANGUAGE_OPTIONS, DeleteTranslator
#include "synthesize.h" #include "wavegen.h" // for InitBreath
#include "translate.h"


MNEM_TAB genders[] = { MNEM_TAB genders[] = {
{ "male", ENGENDER_MALE }, { "male", ENGENDER_MALE },

+ 2
- 5
src/libespeak-ng/wavegen.c View File

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


#include "wavegen.h" #include "wavegen.h"

#include "synthesize.h" // for WGEN_DATA, RESONATOR, frame_t
#include "synthesize.h" #include "mbrola.h" // for MbrolaFill, MbrolaReset, mbrola...
#include "speech.h"
#include "phoneme.h"
#include "voice.h"


#ifdef INCLUDE_KLATT #ifdef INCLUDE_KLATT
#include "klatt.h" #include "klatt.h"

Loading…
Cancel
Save