Contribute to #68 Reduce count of globals / externs that could be a file-local static variablesmaster
| @@ -2084,7 +2084,7 @@ int TranslateRules(Translator *tr, char *p_start, char *phonemes, int ph_size, c | |||
| int ix; | |||
| unsigned int digit_count = 0; | |||
| char *p; | |||
| ALPHABET *alphabet; | |||
| const ALPHABET *alphabet; | |||
| int dict_flags0 = 0; | |||
| MatchRecord match1 = { 0 }; | |||
| MatchRecord match2 = { 0 }; | |||
| @@ -63,16 +63,16 @@ | |||
| #include "voice.h" // for FreeVoiceList, VoiceReset, current_... | |||
| #include "wavegen.h" // for WavegenFill, WavegenInit, WcmdqUsed | |||
| unsigned char *outbuf = NULL; | |||
| int outbuf_size = 0; | |||
| unsigned char *out_start; | |||
| static unsigned char *outbuf = NULL; | |||
| static int outbuf_size = 0; | |||
| static unsigned char *out_start; | |||
| espeak_EVENT *event_list = NULL; | |||
| int event_list_ix = 0; | |||
| int n_event_list; | |||
| long count_samples; | |||
| static int event_list_ix = 0; | |||
| static int n_event_list; | |||
| static long count_samples; | |||
| #ifdef HAVE_PCAUDIOLIB_AUDIO_H | |||
| struct audio_object *my_audio = NULL; | |||
| static struct audio_object *my_audio = NULL; | |||
| #endif | |||
| static unsigned int my_unique_identifier = 0; | |||
| @@ -83,7 +83,7 @@ static int voice_samplerate = 22050; | |||
| static int min_buffer_length = 60; // minimum buffer length in ms | |||
| static espeak_ng_STATUS err = ENS_OK; | |||
| t_espeak_callback *synth_callback = NULL; | |||
| static t_espeak_callback *synth_callback = NULL; | |||
| int (*uri_callback)(int, const char *, const char *) = NULL; | |||
| int (*phoneme_callback)(const char *) = NULL; | |||
| @@ -52,12 +52,12 @@ int n_phoneme_tab; | |||
| int current_phoneme_table; | |||
| PHONEME_TAB *phoneme_tab[N_PHONEME_TAB]; | |||
| unsigned short *phoneme_index = NULL; | |||
| char *phondata_ptr = NULL; | |||
| static unsigned short *phoneme_index = NULL; | |||
| static char *phondata_ptr = NULL; | |||
| unsigned char *wavefile_data = NULL; | |||
| static unsigned char *phoneme_tab_data = NULL; | |||
| int n_phoneme_tables; | |||
| static int n_phoneme_tables; | |||
| PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS]; | |||
| int phoneme_tab_number = 0; | |||
| @@ -461,7 +461,6 @@ extern SPEED_FACTORS speed; | |||
| extern unsigned char *out_ptr; | |||
| extern unsigned char *out_end; | |||
| extern espeak_EVENT *event_list; | |||
| extern t_espeak_callback *synth_callback; | |||
| extern const int version_phdata; | |||
| void DoEmbedded(int *embix, int sourceix); | |||
| @@ -61,7 +61,7 @@ | |||
| #define OFFSET_ETHIOPIC 0x1200 | |||
| // character ranges must be listed in ascending unicode order | |||
| ALPHABET alphabets[] = { | |||
| const ALPHABET alphabets[] = { | |||
| { "_el", OFFSET_GREEK, 0x380, 0x3ff, L('e', 'l'), AL_DONT_NAME | AL_NOT_LETTERS | AL_WORDS }, | |||
| { "_cyr", OFFSET_CYRILLIC, 0x400, 0x52f, 0, 0 }, | |||
| { "_hy", OFFSET_ARMENIAN, 0x530, 0x58f, L('h', 'y'), AL_WORDS }, | |||
| @@ -92,10 +92,10 @@ ALPHABET alphabets[] = { | |||
| { NULL, 0, 0, 0, 0, 0 } | |||
| }; | |||
| ALPHABET *AlphabetFromChar(int c) | |||
| const ALPHABET *AlphabetFromChar(int c) | |||
| { | |||
| // Find the alphabet from a character. | |||
| ALPHABET *alphabet = alphabets; | |||
| const ALPHABET *alphabet = alphabets; | |||
| while (alphabet->name != NULL) { | |||
| if (c <= alphabet->range_max) { | |||
| @@ -77,17 +77,17 @@ char skip_marker[N_MARKER_LENGTH]; | |||
| bool skipping_text; // waiting until word count, sentence count, or named marker is reached | |||
| int end_character_position; | |||
| int count_sentences; | |||
| int count_words; | |||
| static int count_words; | |||
| int clause_start_char; | |||
| int clause_start_word; | |||
| bool new_sentence; | |||
| static bool new_sentence; | |||
| static int word_emphasis = 0; // set if emphasis level 3 or 4 | |||
| static int embedded_flag = 0; // there are embedded commands to be applied to the next phoneme, used in TranslateWord2() | |||
| static int max_clause_pause = 0; | |||
| static bool any_stressed_words; | |||
| int pre_pause; | |||
| ALPHABET *current_alphabet; | |||
| static ALPHABET *current_alphabet; | |||
| char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes | |||
| int n_ph_list2; | |||
| @@ -660,7 +660,7 @@ char *strchr_w(const char *s, int c); | |||
| void InitNamedata(void); | |||
| void InitText(int flags); | |||
| void InitText2(void); | |||
| ALPHABET *AlphabetFromChar(int c); | |||
| const ALPHABET *AlphabetFromChar(int c); | |||
| Translator *SelectTranslator(const char *name); | |||
| int SetTranslator2(const char *name); | |||
| @@ -50,8 +50,8 @@ static void ApplySpecialAttribute2(Translator *tr, char *phonemes, int dict_flag | |||
| static void ChangeWordStress(Translator *tr, char *word, int new_stress); | |||
| static int CheckDottedAbbrev(char *word1); | |||
| static int NonAsciiNumber(int letter); | |||
| static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes, int spell_word, ALPHABET *current_alphabet, char word_phonemes[]); | |||
| static int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, ALPHABET *current_alphabet); | |||
| static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes, int spell_word, const ALPHABET *current_alphabet, char word_phonemes[]); | |||
| static int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, const ALPHABET *current_alphabet); | |||
| static int Unpronouncable(Translator *tr, char *word, int posn); | |||
| static int Unpronouncable2(Translator *tr, char *word); | |||
| @@ -746,7 +746,7 @@ static void ChangeWordStress(Translator *tr, char *word, int new_stress) | |||
| *word = 0; | |||
| } | |||
| static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes, int spell_word, ALPHABET *current_alphabet, char word_phonemes[]) | |||
| static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes, int spell_word, const ALPHABET *current_alphabet, char word_phonemes[]) | |||
| { | |||
| int posn = 0; | |||
| int capitals = 0; | |||
| @@ -783,7 +783,7 @@ static const int number_ranges[] = { | |||
| }; | |||
| static int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, ALPHABET *current_alphabet) | |||
| static int TranslateLetter(Translator *tr, char *word, char *phonemes, int control, const ALPHABET *current_alphabet) | |||
| { | |||
| // get pronunciation for an isolated letter | |||
| // return number of bytes used by the letter | |||
| @@ -794,7 +794,7 @@ static int TranslateLetter(Translator *tr, char *word, char *phonemes, int contr | |||
| int n_bytes; | |||
| int letter; | |||
| int len; | |||
| ALPHABET *alphabet; | |||
| const ALPHABET *alphabet; | |||
| int al_offset; | |||
| int al_flags; | |||
| int number; | |||
| @@ -1123,7 +1123,7 @@ static int Unpronouncable(Translator *tr, char *word, int posn) | |||
| int vowel_posn = 9; | |||
| int index; | |||
| int count; | |||
| ALPHABET *alphabet; | |||
| const ALPHABET *alphabet; | |||
| utf8_in(&c, word); | |||
| if ((tr->letter_bits_offset > 0) && (c < 0x241)) { | |||
| @@ -50,7 +50,7 @@ | |||
| static void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v); | |||
| voice_t *wvoice = NULL; | |||
| static voice_t *wvoice = NULL; | |||
| static int option_harmonic1 = 10; | |||
| static int flutter_amp = 64; | |||
| @@ -89,7 +89,7 @@ static int modulation_type = 0; | |||
| static int glottal_flag = 0; | |||
| static int glottal_reduce = 0; | |||
| WGEN_DATA wdata; | |||
| static WGEN_DATA wdata; | |||
| static int amp_ix; | |||
| static int amp_inc; | |||
| @@ -111,7 +111,7 @@ unsigned char *out_ptr; | |||
| unsigned char *out_end; | |||
| espeak_ng_OUTPUT_HOOKS* output_hooks = NULL; | |||
| int const_f0 = 0; | |||
| static int const_f0 = 0; | |||
| // the queue of operations passed to wavegen from sythesize | |||
| intptr_t wcmdq[N_WCMDQ][4]; | |||
| @@ -122,8 +122,6 @@ int wcmdq_tail = 0; | |||
| int embedded_default[N_EMBEDDED_VALUES] = { 0, 50, espeakRATE_NORMAL, 100, 50, 0, 0, 0, espeakRATE_NORMAL, 0, 0, 0, 0, 0, 0 }; | |||
| static int embedded_max[N_EMBEDDED_VALUES] = { 0, 0x7fff, 750, 300, 99, 99, 99, 0, 750, 0, 0, 0, 0, 4, 0 }; | |||
| int current_source_index = 0; | |||
| #if HAVE_SONIC_H | |||
| static sonicStream sonicSpeedupStream = NULL; | |||
| double sonicSpeed = 1.0; | |||
| @@ -1346,8 +1344,6 @@ static int WavegenFill2() | |||
| case WCMD_MARKER: | |||
| marker_type = q[0] >> 8; | |||
| MarkerEvent(marker_type, q[1], q[2], q[3], out_ptr); | |||
| if (marker_type == 1) // word marker | |||
| current_source_index = q[1] & 0xffffff; | |||
| break; | |||
| case WCMD_AMPLITUDE: | |||
| SetAmplitude(length, (unsigned char *)q[2], q[3]); | |||