Commit 39f4d5c7 authored by LiberIT's avatar LiberIT

Merge remote-tracking branch 'origin/dev'

parents 44095c89 2475ee8b
Pipeline #109296161 passed with stages
in 2 minutes and 59 seconds
......@@ -762,10 +762,11 @@ struct Paragraph process_derived_word(struct Phrase tablet, word_t number) {
return tablet;
}
struct Text find_letter_quote(struct Text text) {
struct Text find_letter_quote(const struct Text text) {
// what to do here?
// what assumptions do we have?
// quotes start with a zi, so look for that;
conditional(text.length == 0, return text);
NewText(zi, "zi");
struct Text first_zi = letter_found(text, zi);
// that the dot is next, may need the first word also?
......@@ -775,7 +776,8 @@ struct Text find_letter_quote(struct Text text) {
// find first dot
struct Text first_dot = letter_found(text, dot);
// if not found then return text length 0
conditional(first_dot.length == 0, text.length = 0; return text);
struct Text produce = text;
conditional(first_dot.length == 0, produce.length = 0; return produce);
// DEBUGPRINT(("%s first_dot\n", first_dot.letters));
// adjust search text to be remainder of text
struct Text search_text = first_dot;
......@@ -792,8 +794,8 @@ struct Text find_letter_quote(struct Text text) {
search_text.length = text.length + text.letters - search_text.letters;
struct Text next_quote_indicator = letter_found(search_text, quote_indicator);
if (next_quote_indicator.length == 0) {
text.length = 0;
return text;
produce.length = 0;
return produce;
}
struct Text zi_search = search_text;
zi_search.letters = next_quote_indicator.letters + next_quote_indicator.length;
......@@ -811,7 +813,8 @@ struct Text find_letter_quote(struct Text text) {
final_zi.length - quoted_text.letters;
return quoted_text;
}
struct Text find_letter_quote_contents(struct Text text) {
struct Text find_letter_quote_contents(const struct Text text) {
conditional(text.length == 0, return text);
// what to do here?
// what assumptions do we have?
// quotes start with a zi, so look for that;
......@@ -822,7 +825,8 @@ struct Text find_letter_quote_contents(struct Text text) {
// find first dot
struct Text first_dot = letter_found(text, dot);
// if not found then return text length 0
conditional(first_dot.length == 0, text.length = 0; return text);
struct Text produce = text;
conditional(first_dot.length == 0, produce.length = 0; return produce);
// DEBUGPRINT(("%s first_dot\n", first_dot.letters));
// adjust search text to be remainder of text
struct Text search_text = first_dot;
......@@ -839,8 +843,8 @@ struct Text find_letter_quote_contents(struct Text text) {
search_text.length = text.length + text.letters - search_text.letters;
struct Text next_quote_indicator = letter_found(search_text, quote_indicator);
if (next_quote_indicator.length == 0) {
text.length = 0;
return text;
produce.length = 0;
return produce;
}
//text_print(next_quote_indicator);
//DEBUGPRINT(("%lX next_quote_indicator.letters\n", next_quote_indicator.letters
......@@ -853,7 +857,7 @@ struct Text find_letter_quote_contents(struct Text text) {
return quoted_text;
}
struct Phrase process_letter_quote(struct Phrase tablet, struct Text text,
struct Phrase process_letter_quote(struct Phrase tablet, const struct Text text,
uint8_t *text_indexFinger) {
struct Text letter_quote = find_letter_quote(text);
struct Text quoted_text = find_letter_quote_contents(text);
......@@ -968,12 +972,14 @@ struct Phrase encode_paragraph_quote(struct Phrase phrase, struct Text text,
// delete the trailing verb words we no longer needed
// addenda declarative_mood_GRAMMAR
addenda_theGrammarWord_toThePhrase(declarative_mood_GRAMMAR, phrase);
text_print(text);
Page_print(phrase.page);
// #TODO
// add the quote contents
// maybe with some version of process_letter_quote
// need a "get quote length" kinda thing to know how much text it involves.
//struct Text full_quote = find_letter_quote(text);
struct Text full_quote = find_letter_quote(text);
text_print(text);
//DEBUGPRINT(("%X full_quote.length\n", full_quote.length));
//if (full_quote.length > 0) {
// *text_indexFinger = full_quote.letters+full_quote.length - full_quote.letters;
......
......@@ -65,9 +65,9 @@ uint8_t fyakhzotlwoh_kehlaskfiskfamka_twicri(struct Phrase phrase);
#define howMuch_lineVacancy_remains_atThePhraseTermination \
fyakhzotlwoh_kehlaskfiskfamka_twicri
struct Phrase process_letter_quote(struct Phrase tablet, struct Text text,
struct Phrase process_letter_quote(struct Phrase tablet, const struct Text text,
uint8_t *text_indexFinger);
struct Text find_letter_quote_contents(struct Text text);
struct Text find_letter_quote(struct Text text);
struct Text find_letter_quote_contents(const struct Text text);
struct Text find_letter_quote(const struct Text text);
#endif
......@@ -3199,6 +3199,13 @@ const char *quiz_find_letter_quote_null() {
mu_assert("", produce.length == 0);
return 0;
}
const char *quiz_find_letter_quote_null2() {
NewText(input, "");
struct Text produce = find_letter_quote(input);
text_print(produce);
mu_assert("", produce.length == 0);
return 0;
}
const char *quiz_find_letter_quote_1() {
NewText(input, "zi.prih.bonjour.prih.zi pyacli");
NewText(example, "zi.prih.bonjour.prih.zi");
......@@ -3239,6 +3246,7 @@ const char *quiz_process_letter_quote() {
const char *quiz_letter_quote() {
mu_run_quiz(quiz_find_letter_quote);
mu_run_quiz(quiz_find_letter_quote_null);
mu_run_quiz(quiz_find_letter_quote_null2);
mu_run_quiz(quiz_find_letter_quote_1);
mu_run_quiz(quiz_find_letter_quote_contents);
mu_run_quiz(quiz_process_letter_quote);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment