diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2021-12-05 18:16:30 -0500 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2021-12-05 18:16:30 -0500 |
| commit | 61b4313d03a93f50c5cb9d7320f3db7c21caa9f3 (patch) | |
| tree | ee033e83a8ef3d602c16534d2dce3cf61259d83c /jdtalk.h | |
| parent | 236ceeb996f490d24b54984ba0833f0d4606a3de (diff) | |
| download | jdtalkc-61b4313d03a93f50c5cb9d7320f3db7c21caa9f3.tar.gz | |
Improvements, and heavy optimization to string search
* Add error checking to all allocs
* Add general format checking
* Add acronym format checking
* Consolidate dictionary creation into different helper functions
* Add ability to get a random word of a type without scanning the entire dictionary
* Added function doc strings (incomplete)
Diffstat (limited to 'jdtalk.h')
| -rw-r--r-- | jdtalk.h | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -40,6 +40,8 @@ int dictionary_read(FILE *fp, struct Dictionary **dict, unsigned type); struct Dictionary *dictionary_populate(); int dictionary_contains(struct Dictionary *dict, const char *s, unsigned type); char *dictionary_word(struct Dictionary *dict, unsigned type); +char *dictionary_word_formats(struct Dictionary *dict, char *s); +struct Dictionary *dictionary_of(struct Dictionary **src, unsigned type); void dictionary_free(struct Dictionary *dict); char *str_random_case(char *s); @@ -48,10 +50,12 @@ char *str_leet(char *s); char *str_title_case(char *s); char *str_randomize_words(char *s); char *str_reverse(char *s); +char *str_album(char *s, char **parts); -char *talkf(struct Dictionary *dict, const char *fmt, char **parts); -char *talk_salad(struct Dictionary *dict, size_t limit, char **parts); -char *talk_acronym(struct Dictionary *dict, const char *fmt, char *s, char **parts); -int acronym_safe(const char *acronym, const char *pattern); +char *talkf(struct Dictionary *dict[], char *fmt, char **parts, size_t parts_max); +char *talk_salad(struct Dictionary *dict[], size_t limit, char **parts, size_t parts_max); +char *talk_acronym(struct Dictionary *dict[], __attribute__((unused)) char *fmt, char *s, char **parts, size_t parts_max); +int acronym_safe(struct Dictionary *dict, const char *acronym, const char *pattern, const char *fmt); +int format_safe(char *s); #endif //JDTALKC_JDTALK_H |
