| #include "translate.h" // for Translator, utf8_in, LANGU... | #include "translate.h" // for Translator, utf8_in, LANGU... | ||||
| static int LookupFlags(Translator *tr, const char *word, unsigned int flags_out[2]); | static int LookupFlags(Translator *tr, const char *word, unsigned int flags_out[2]); | ||||
| static void DollarRule(char *word[], char *word_start, int consumed, int group_length, char *word_buf, Translator *tr, int command, int *failed, int *add_points); | |||||
| static void DollarRule(char *word[], char *word_start, int consumed, int group_length, char word_buf[N_WORD_BYTES], Translator *tr, int command, int *failed, int *add_points); | |||||
| typedef struct { | typedef struct { | ||||
| int points; | int points; | ||||
| return end_flags; | return end_flags; | ||||
| } | } | ||||
| static void DollarRule(char *word[], char *word_start, int consumed, int group_length, char *word_buf, Translator *tr, int command, int *failed, int *add_points) { | |||||
| static void DollarRule(char *word[], char *word_start, int consumed, int group_length, char word_buf[N_WORD_BYTES], Translator *tr, int command, int *failed, int *add_points) { | |||||
| // $list or $p_alt | // $list or $p_alt | ||||
| // make a copy of the word up to the post-match characters | // make a copy of the word up to the post-match characters | ||||
| int ix = *word - word_start + consumed + group_length + 1; | int ix = *word - word_start + consumed + group_length + 1; | ||||
| if (ix+2 > N_WORD_BYTES) { | |||||
| *failed = 1; | |||||
| return; | |||||
| } | |||||
| memcpy(word_buf, word_start-1, ix); | memcpy(word_buf, word_start-1, ix); | ||||
| word_buf[ix] = ' '; | word_buf[ix] = ' '; | ||||
| word_buf[ix+1] = 0; | word_buf[ix+1] = 0; |