Commit Graph
100 Commits
Author SHA1 Message Date
Juho Hiltunen 59177db8ef cleanup: fix code smell knownConditionTrueFalse
Inner 'p->stresslevel>=4' will always be true. Thus checking for
count_stressed is redundant.
2022-10-25 19:51:02 +03:00
Juho Hiltunen ef809dcd7e SetSpeed() refactoring (#1465)
Unify common parts of two implementations. Split into smaller functions.
2022-10-25 19:32:32 +03:00
Juho Hiltunen d1e98942e3 Update README.md (#1442)
Google is now a LLC not Inc.
2022-10-25 19:30:55 +03:00
Juho Hiltunen b94a5b160b Add arm CI (#1463)
This allows to cover
- another arch that x86, which is also very common
- an arch where char is unsigned
- a little-endian arch

This is running under qemu-user, so significantly slower and doesn't
support ptrace thus no address sanitizer etc. but at least the undefined
sanitizer works.
2022-10-25 19:29:20 +03:00
Juho Hiltunen 8170775113 code cleanup: refactor and remove duplication by unifying SetSpeed()
implemantations.

It is unclear why the two implementations differ.
2022-10-25 19:24:55 +03:00
Juho Hiltunen 0c82988b44 cleanup: refactor and remove duplication from SetSpeed() implementations. 2022-10-25 19:24:55 +03:00
Juho Hiltunen 84f58824af cleanup: refactor and remove duplication from SetSpeed() implementations. 2022-10-25 19:24:55 +03:00
Juho Hiltunen 9e9fb16b56 cleanup: use parameters instead of globals with SetSpeedMods 2022-10-25 19:24:55 +03:00
Juho Hiltunen a4c70d7921 cleanup: remove setting samplerate with Sonic.
we currently only support 22050 as samplerate so this code has no
effect. This should be readded to setSpeed() with and without Sonic if
multiple samplerates are supported in the future.
2022-10-25 18:24:27 +03:00
Juho Hiltunen bc16f819dd cleanup: refactor and remove duplication from SetSpeed() implementations.
There are two SetSpeed(), one for Sonic and one without. The differences
are very small.

In SetSpeedMods(), sample rate is adjusted for Sonic only:
 speed.min_sample_len = (speed.min_sample_len * samplerate_native) / 22050;

Since samplerate_native is 22050 at the moment this line has no effect.
2022-10-24 21:49:12 +03:00
Juho Hiltunen 5db96bd845 Staticanalysis (#1457)
Fixes for code smells from cppcheck static code analysis tool.

Also includes some function refactoring.
2022-10-23 19:45:47 +03:00
Juho Hiltunen 9e3ade9004 cleanup: reduce variable scopes in ssml.c
Contributes to #9.
2022-10-23 19:34:59 +03:00
Juho Hiltunen 185c93e702 cleanup: reduce variable scopes in readclause.c
Contributes to #9.
2022-10-23 19:15:18 +03:00
Juho Hiltunen 9be76c0b30 cleanup: fix cppcheck unusedVariable code smells 2022-10-23 18:44:30 +03:00
Juho Hiltunen 0551a234eb cleanup: reduce variable scopes in translateword.c
Contributes to #9.
2022-10-23 18:34:15 +03:00
Juho Hiltunen b4053da400 cleanup: fix cppcheck identicalInnerCondition code smells 2022-10-23 18:09:06 +03:00
Juho Hiltunen 77df00ad79 cleanup: fix cppcheck unreadVariable code smell in common.c 2022-10-23 17:32:41 +03:00
Juho Hiltunen 80a632ed26 cleanup: reduce variable scopes in common.c
Contributes to #9.
2022-10-23 17:32:41 +03:00
Juho Hiltunen 39ea6e3a90 cleanup: reduce variable scopes in translate.c
Contributes to #9.

Found with cppcheck static code analyzer variableScope parameter.
2022-10-23 17:28:20 +03:00
Juho Hiltunen ef1b562714 cleanup: remove code duplication by using SetPlist2() 2022-10-23 12:14:59 +03:00
Juho Hiltunen 319ce7b09f cleanup: refactor duplicate loops to CalcWordLength().
Note: This code has no tests. Tests would pass even without a call to
this function.
2022-10-23 12:14:59 +03:00
Juho Hiltunen 139eef57d2 cleanup: refactor checking for _^_ to function SwitchLanguage() 2022-10-23 12:14:59 +03:00
Juho Hiltunen 268f5899c8 fixup e2862bbc
Changing da_rules was accidentally included in the commit.
2022-10-22 17:31:29 +03:00
Juho Hiltunen c92f7b7bfe cleanup: refactor checking FLAG_COMBINE into a function (#1454) 2022-10-22 11:55:38 +03:00
Juho Hiltunen e2862bbc51 cleanup: refactor checking FLAG_COMBINE into a function 2022-10-22 11:49:27 +03:00
Juho Hiltunen 43d7c29d52 Increase targetSdk to 30 and support signature scheme v2 (#1413)
[This removes the warning that this app may not be compatible because it
was developed for an older
android-version.](https://developer.android.com/about/versions/10/behavior-changes-all#low-target-sdk-warnings)
Also, this adds support for signature scheme v2 and v3 [which reduces
the attack surface along with other
benefits](https://source.android.com/docs/security/features/apksigning#v1).
Lastly this adds 64-bit support for the APK, so this app can be
installed on 64-bit-only hardware.
2022-10-11 06:37:17 +03:00
Juho Hiltunen c05690be34 cleanup: move LoadConfig to langopts.c
LoadConfig() should be refactored to support both voice and language options set
in LoadVoice() and LoadLanguageOptions().
2022-10-10 21:36:25 +03:00
Juho Hiltunen 0f1f006afe Merge branch 'spellingStress' 2022-10-10 21:25:29 +03:00
Juho Hiltunen dc60881171 et: fi: move spellingStress from code to language configuration 2022-10-10 21:20:53 +03:00
Juho Hiltunen 53e40ead80 docs: add spellingStress 2022-10-10 21:20:53 +03:00
Juho Hiltunen 015bb42a70 new configurable language option: spellingStress 2022-10-10 21:20:20 +03:00
Juho Hiltunen f342b5d319 cleanup: make spelling_stress bool and set default value 2022-10-10 21:04:25 +03:00
Juho Hiltunen e03ab8a8c4 tests: add a test for langopts.spelling_stress 2022-10-10 21:04:25 +03:00
Juho Hiltunen c701b09c25 cleanup: reorganize LOPT defines 2022-10-10 20:08:22 +03:00
Juho Hiltunen 4d70ceceb5 Remove LOPT_IT_DOUBLING and delete unused functionality.
Code checked for both langopt LOPT_IT_DOUBLING and attribe $double.
LOPT_IT_DOUBLING is redundant. $double already has a test in
dictionary.test

Code had a check for tr->langopts.param[LOPT_IT_DOUBLING] & 2 but that bit value is
not used in any language. That logic was removed.
2022-10-10 19:57:23 +03:00
Juho Hiltunen 3b2557cfdd et: fi: move configuration from code to language file 2022-10-10 19:49:42 +03:00
Juho Hiltunen 644f02c26a fixup case V_TUNES
previous changing of variable names caused an error in the program logic.
2022-10-10 19:45:01 +03:00
Juho Hiltunen 78c9b55c5f fixup language options status and maintainer. 2022-10-10 19:34:21 +03:00
Juho Hiltunen b4c223a256 fixup: move some language option keywords to the correct MNEM_TAB.
Caused when creating LoadLanguageOptions().
2022-10-09 22:03:18 +03:00
Juho Hiltunen 7115e46879 fi: uncomment number configuration.
Accidentally commented out in ac82698f.
2022-10-09 20:41:22 +03:00
Juho Hiltunen 74fc17bbf1 Create langopts.c for language option configuration (#1419)
Loading Voice and Language options is complicated. They are not
separated in the code.

This PR creates langopts.c for holding language option related
configuration. In the future:
1. all new language options should go to langopts.c
2. voice options should have a similar file
3. LoadVoice should know if it's loading a voice or a language.
2022-10-09 16:48:18 +03:00
Juho Hiltunen a19e4b8df2 resize and initialize a two-dimensional array to pass sanitizer 2022-10-09 16:38:53 +03:00
Juho Hiltunen eae4595dc9 cleanup: move shared enums and MNEM_TABs to header file 2022-10-09 16:38:53 +03:00
Juho Hiltunen 78c6873427 cleanup: call CheckTranslator at start of LoadLangugeOptions 2022-10-09 16:38:53 +03:00
Juho Hiltunen 3182dee147 code cleanup: move CheckTranslator() to langopts.c 2022-10-09 16:38:53 +03:00
Juho Hiltunen 159ab0ee76 cleanup: move langopts.params handling to LoadLanguageOptions()
These have no tests and should be refactore to be similar to other
langopts.
2022-10-09 16:38:53 +03:00
Juho Hiltunen b820b68182 cleanup: move words to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00
Juho Hiltunen ac82698f99 cleanup: move numbers to LoadLanguageOptions()
Note: This feature has no tests.
2022-10-09 16:38:53 +03:00
Juho Hiltunen bdf18eafb1 cleanup: moved dictmin to LoadLanguageOptions()
Note: This feature has no tests. It doesn't look very useful and I think
could be removed.
2022-10-09 16:38:53 +03:00
Juho Hiltunen e1d936dc52 cleanup: moved dictrules to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00
Juho Hiltunen f28841162f moved tunes to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00
Juho Hiltunen c92180f918 cleanup: move n_tunes and tunes to where they are used 2022-10-09 16:38:53 +03:00
Juho Hiltunen ec897eff32 fixup, add langopts.h to version control 2022-10-09 16:38:53 +03:00
Juho Hiltunen e38142acd1 cleanup: moved intonation to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00
Juho Hiltunen 8e3399bb98 cleanup: move stressRule to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00
Juho Hiltunen 9caada3b31 cleanup: move stressOpt to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00
Juho Hiltunen 46bc25e173 cleanup: move stressAmp to LoadLanguageOptions() 2022-10-09 16:38:53 +03:00
Juho Hiltunen 2a462e4afe cleanup: move stressAdd to LoadLanguageOptions() 2022-10-09 16:38:52 +03:00
Juho Hiltunen db57230320 fixup error message for Bad Voice attribute.
We currently have two switch statements. Every key should go to only one
of them.
2022-10-09 16:38:52 +03:00
Juho Hiltunen 77282aca34 cleanup: move stressLength to LoadLanguageOptions() 2022-10-09 16:38:52 +03:00
Juho Hiltunen 4a2890250b code cleanup: new file langopts.c for handling language options.
The switch case in LoadVoice() currently mixes voice and language
options. This change will start separating them into two functions.

CheckTranslator will be moved to langopts.c. In the future there should
be no need to use it in voices.c. There will be other temporary
solutions also.
2022-10-09 16:38:52 +03:00
Juho Hiltunen e5ae5b8557 tr: fix bağışlamak and bağışlayın
This removes these words from dictionary and uses translation rules
instead. Result is to shorten the i.

See #1337 and #1388.
2022-10-04 17:19:10 +03:00
Juho Hiltunen b17ed2d682 Update Changelog 2022-09-29 07:18:23 +03:00
Juho Hiltunen a434ca4cbb fix #1370 Cmn voice not correctly translated
1. Rewrite cmn_rules. Vowel will be spoken as Mandarin only when it's
with a tone number. Otherwise, it will be regarded as English. This will
make English words translated more correctly.
2. Fix issue of word item in cmn_listx not taking effect.
3. Fix dictionary_skipwords bug. It should be injected when re-structing
method TranslateWord3.
2022-09-29 07:09:34 +03:00
Juho Hiltunen f5442cfe4e Merge branch 'master' into master 2022-09-29 06:22:28 +03:00
Juho Hiltunen b52441f9ac tr: do not prolong â and î.
See #1388 and #875.
2022-09-27 20:35:42 +03:00
Juho Hiltunen 4f9044c99f Updates italian source dictionaries (#1395)
Add some rules and exceptions for italian language.
2022-09-25 20:30:57 +03:00
Juho Hiltunen e46ed1ab16 Merge branch 'master' into master 2022-09-24 21:47:27 +03:00
Juho Hiltunen 80976d7fbf docs: add a section about tests when adding a new language
Closes #1194.
2022-09-24 08:25:26 +03:00
jaacoppi df8af89ddd Merge pull request #1379
Code cleanup: relocate functions & remove unused #defines
2022-09-17 20:03:10 +03:00
jaacoppi 57115a8eaf Merge pull request #1376 from bkmgit/patch-1
Fix vowels link
2022-09-17 19:29:42 +03:00
Juho Hiltunen 545f38a46b code cleanup: remove unused #defines
Note: Strange that FLAG_ALT7 is used but ALT4-ALT6 are not. Same with
R6p.
2022-09-17 19:19:44 +03:00
Juho Hiltunen 4a9f0e21be code cleanup: move Is*() helper functions to common.c 2022-09-17 18:57:20 +03:00
Juho Hiltunen 57c7285ff9 code cleanup: move ApplySpecialAttribute2() 2022-09-17 18:20:38 +03:00
Juho Hiltunen 741bea9510 code cleanup: make LookupFlags() static 2022-09-17 18:09:23 +03:00
Juho Hiltunen 597cb2f440 code cleanup: move Unpronouncable() and Unpronouncable2() 2022-09-17 18:05:01 +03:00
Juho Hiltunen 9d03b09537 code cleanup: move ChangeWordStress() 2022-09-17 18:05:01 +03:00
Juho Hiltunen c5db9220bf code cleanup: move Read4Bytes() 2022-09-17 17:41:43 +03:00
Juho Hiltunen 14ede3e372 code cleanup: move is_str_totally_null() 2022-09-17 17:28:52 +03:00
Juho Hiltunen 64f12fec87 code cleanup: move towlower2() 2022-09-17 17:22:01 +03:00
Juho Hiltunen ac3b9f6199 code cleanup: move utf8_* functions.
utf8_nbytes() is only used in dictionary.c. Others are moved to common.c
2022-09-17 11:24:59 +03:00
Juho Hiltunen b52d1f3afd code cleanup: move strncpy0 to common.c 2022-09-04 07:12:39 +03:00
Juho Hiltunen c4d8976fbc code cleanup: Add new source file common.h for misc functions. 2022-09-03 21:19:37 +03:00
Juho Hiltunen 47b1b5baeb code cleanup: move TranslateWord3() and others o translateword.c
Use parameters instead of globals. Note the change from sizeof(word_phonemes) to size_word_phonemes.
2022-09-03 11:54:10 +03:00
Juho Hiltunen 5e7c105723 code cleanup: move TranslateLetter() and others to translateword.c 2022-09-03 11:46:16 +03:00
Juho Hiltunen fb06936c51 code cleanup: start moving translateWord3() to a new source file.
The file will be organized to have one callable function only. This
should make code structure simpler.

Existing code will be changed to use function parameters instead of
global variables.

Possible problems include too much dependencies with numbers.c.
2022-09-03 11:41:30 +03:00
Juho Hiltunen c4be2c90ad code cleanup: remove irrelevant comment 2022-09-02 21:10:10 +03:00
Juho Hiltunen 54963ebee2 code cleanup: remove unused int prev_clause_pause 2022-09-02 21:02:44 +03:00
Juho Hiltunen 0e07d929fd code cleanup: refactor checking phoneme_mode into a function 2022-09-01 20:50:27 +03:00
Juho Hiltunen 1443c970cd cmn: search for dictionary matches instead of translating characters.
cmn (Mandarin chinese) has been broken since 4825905.

This fix makes mandarin behave more like Cantonese. Instead of
translating characters, we search for dictionary matches.

The functionality of normal vs Chao tones should be investigated more.
Looks like latin characters as pinyin still uses Chao tones whereas
the characters in cmn_list and cmn_listx do not.

See #1044 for discussion. See also #1028 and #1163.
2022-08-31 21:15:29 +03:00
Juho Hiltunen 366658e85a cmn: yue: add tests for latin characters as English or pinyin/jyutping 2022-08-31 21:15:23 +03:00
Juho Hiltunen 69c79ab931 code cleanup: remove unused phonemetable ph_yoruba 2022-08-29 21:26:00 +03:00
Juho Hiltunen 89522c6431 code cleanup: remove unused phonemetable ph_burmese
Myanmar/Burmese (my) uses phonemetable ph_myanmar instead.
2022-08-29 21:24:20 +03:00
Juho Hiltunen 0dbe71827e remove unused phonemetable for kinyarwanda.
Fixup for commit 89768755.
2022-08-28 21:53:11 +03:00
Juho Hiltunen 4e7740fa96 code cleanup: remove unused phonemetable ak (akan) 2022-08-28 21:40:00 +03:00
Juho Hiltunen 2ef9d75067 code cleanup: remove dead code related to language 'wo'
This is the only reference to the language.
2022-08-28 21:34:03 +03:00
Juho Hiltunen 8976875590 code cleanup: remove dead code related to Kiryarwanda
This is the only reference to the language.
2022-08-28 21:34:03 +03:00
Juho Hiltunen 3eb43c1ef5 code cleanup: remove dead code related to Tibetan
Language 'bo' has no data files. Tibetan might have been supported
before but clearly isn't any longer.
2022-08-28 20:40:58 +03:00
Juho Hiltunen 7492475728 code cleanup: make a function for checking tr->chars_ignore
ReadClause() is very long and should be shortened for code readability
2022-08-28 20:13:32 +03:00
Juho Hiltunen a161118976 code cleanup: move lookupwchar2 to readclause.c
It's used only in readclause.c

TODO: Rename so the meaning of the function is easier to understand.
2022-08-28 20:13:16 +03:00