Browse Source

code cleanup: move Read4Bytes()

master
Juho Hiltunen 2 years ago
parent
commit
c5db9220bf

+ 14
- 0
src/libespeak-ng/common.c View File

return (*str == 0 && memcmp(str, str+1, size-1) == 0); return (*str == 0 && memcmp(str, str+1, size-1) == 0);
} }


int Read4Bytes(FILE *f)
{
// Read 4 bytes (least significant first) into a word
int ix;
unsigned char c;
int acc = 0;

for (ix = 0; ix < 4; ix++) {
c = fgetc(f) & 0xff;
acc += (c << (ix*8));
}
return acc;
}

int towlower2(unsigned int c, Translator *translator) int towlower2(unsigned int c, Translator *translator)
{ {
// check for non-standard upper to lower case conversions // check for non-standard upper to lower case conversions

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

extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size); extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size);


int is_str_totally_null(const char* str, int size); // Tests if all bytes of str up to size are null int is_str_totally_null(const char* str, int size); // Tests if all bytes of str up to size are null
int Read4Bytes(FILE *f);
int towlower2(unsigned int c, Translator *translator); // Supports Turkish I int towlower2(unsigned int c, Translator *translator); // Supports Turkish I


ESPEAK_NG_API int utf8_in(int *c, const char *buf); ESPEAK_NG_API int utf8_in(int *c, const char *buf);

+ 1
- 2
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 "common.h" // for GetFileLength, strncpy0
#include "common.h" // for GetFileLength, strncpy0, ...
#include "error.h" // for create_file_error_context #include "error.h" // for create_file_error_context
#include "mnemonics.h" // for LookupMnemName, MNEM_TAB #include "mnemonics.h" // for LookupMnemName, MNEM_TAB
#include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST #include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST
#include "readclause.h" // for Read4Bytes
#include "spect.h" // for SpectFrame, peak_t, SpectSeq #include "spect.h" // for SpectFrame, peak_t, SpectSeq
#include "speech.h" // for path_home, GetFileLength #include "speech.h" // for path_home, GetFileLength
#include "synthdata.h" // for LoadPhData #include "synthdata.h" // for LoadPhData

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

return buf; return buf;
} }


int Read4Bytes(FILE *f)
{
// Read 4 bytes (least significant first) into a word
int ix;
unsigned char c;
int acc = 0;

for (ix = 0; ix < 4; ix++) {
c = fgetc(f) & 0xff;
acc += (c << (ix*8));
}
return acc;
}

static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output, int *bufix, int end_clause) static int AnnouncePunctuation(Translator *tr, int c1, int *c2_ptr, char *output, int *bufix, int end_clause)
{ {
// announce punctuation names // announce punctuation names

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

int clause_type_from_codepoint(uint32_t c); int clause_type_from_codepoint(uint32_t c);
int Eof(void); int Eof(void);
const char *WordToString2(unsigned int word); const char *WordToString2(unsigned int word);
int Read4Bytes(FILE *f);
int AddNameData(const char *name, int AddNameData(const char *name,
int wide); int wide);
int ReadClause(Translator *tr, int ReadClause(Translator *tr,

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

#include "soundicon.h" #include "soundicon.h"
#include "common.h" // for GetFileLength #include "common.h" // for GetFileLength
#include "error.h" // for create_file_error_context #include "error.h" // for create_file_error_context
#include "readclause.h" // for Read4Bytes
#include "speech.h" // for path_home, PATHSEP #include "speech.h" // for path_home, PATHSEP
#include "synthesize.h" // for samplerate #include "synthesize.h" // for samplerate



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



#include "dictionary.h" #include "dictionary.h"
#include "mbrola.h" #include "mbrola.h"
#include "readclause.h"
#include "setlengths.h" #include "setlengths.h"
#include "synthdata.h" #include "synthdata.h"
#include "wavegen.h" #include "wavegen.h"

Loading…
Cancel
Save