From 10ec5e96d65b58dbe915c2d622b0bfb8abbd122b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 21 Dec 2019 11:38:05 -0500 Subject: reduce use of auto, much with tuples --- org/metaverse.org | 80 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 29 deletions(-) (limited to 'org/metaverse.org') diff --git a/org/metaverse.org b/org/metaverse.org index cc8414b..be6c662 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -238,6 +238,28 @@ int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,] int[] dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; +alias TxtPlusHasFootnotes = Tuple!( + string, "obj_txt", + bool, "has_notes_reg", + bool, "has_notes_star", + bool, "has_notes_plus", +); +alias TxtPlusHasFootnotesUrlsImages = Tuple!( + string, "obj_txt", + bool, "has_notes_reg", + bool, "has_notes_star", + bool, "has_notes_plus", + bool, "has_urls", + bool, "has_images_without_dimensions", +); +alias TxtAndAnchorTagPlusHasFootnotesUrlsImages = Tuple!( + string, "obj_txt", + string, "anchor_tag", + bool, "has_notes_reg", + bool, "has_notes_star", + bool, "has_links", + bool, "has_images_without_dimensions", +); enum DomTags { none, open, close, close_and_open, open_still, } #+END_SRC @@ -1295,7 +1317,7 @@ if ((obj_type_status["heading"] == State.on) : ocn_emit(obj_type_status["ocn_status"]); an_object["is"] = "heading"; an_object_key="body_nugget"; - auto substantive_object_and_anchor_tags_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, ((_new_doc) ? Yes._new_doc : No._new_doc)); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag]; @@ -1440,7 +1462,7 @@ if ((obj_type_status["heading"] == State.on) heading_ptr-1, an_object["is"], ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -3943,7 +3965,7 @@ string[string] flow_txt_block_poem(CMM)( ); } an_object["is"] = "verse"; - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4006,7 +4028,7 @@ string[string] flow_txt_block_poem(CMM)( heading_ptr-1, an_object["is"] ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4052,7 +4074,7 @@ string[string] flow_txt_block_poem(CMM)( } processing.remove("verse"); an_object["is"] = "verse"; - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4115,7 +4137,7 @@ string[string] flow_txt_block_poem(CMM)( heading_ptr-1, an_object["is"] ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4261,7 +4283,7 @@ void flow_table_closed_make_special_notation_table_(N,CMM)( "table" ); an_object["is"] = "table"; - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block.metainfo.ocn = obj_cite_digits.object_number; @@ -4339,7 +4361,7 @@ string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( heading_ptr-1, an_object["is"] ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4396,7 +4418,7 @@ string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( heading_ptr-1, an_object["is"] ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4453,7 +4475,7 @@ string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( heading_ptr-1, an_object["is"] ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; // anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4552,7 +4574,7 @@ string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( heading_ptr-1, an_object["is"] ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; @@ -4610,7 +4632,7 @@ string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( heading_ptr-1, an_object["is"] ); - auto substantive_obj_misc_tuple + TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, No._new_doc); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block = comp_obj_block.init; @@ -5422,7 +5444,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - Tuple!(string, bool, bool, bool) footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) @safe { + TxtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) @safe { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; @@ -5478,7 +5500,7 @@ static struct ObjInlineMarkupMunge { } else { obj_txt_out = obj_txt_in; } - Tuple!(string, bool, bool, bool) t = tuple( + TxtPlusHasFootnotes t = tuple( obj_txt_out, flg_notes_reg, flg_notes_star, @@ -5492,7 +5514,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - private Tuple!(string, bool, bool, bool, bool, bool) object_notes_and_links_()( + private TxtPlusHasFootnotesUrlsImages object_notes_and_links_()( string obj_txt_in, bool reset_note_numbers=false ) @safe { @@ -5526,8 +5548,8 @@ static struct ObjInlineMarkupMunge { obj_txt_in = obj_txt_in .replaceAll(rgx.para_inline_link_anchor, "┃$1┃"); } - Tuple!(string, bool, bool, bool) ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); - obj_txt_out = ftn[0]; + TxtPlusHasFootnotes ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); + obj_txt_out = ftn.obj_txt; debug(footnotes) { writeln(obj_txt_out, tail); } @@ -5539,18 +5561,18 @@ static struct ObjInlineMarkupMunge { writeln(m.hit); } } - Tuple!(string, bool, bool, bool, bool, bool) t = tuple( + TxtPlusHasFootnotesUrlsImages t = tuple( obj_txt_out, - ftn[1], - ftn[2], - ftn[3], + ftn.has_notes_reg, + ftn.has_notes_star, + ftn.has_notes_plus, urls, images_without_dimensions, ); return t; } auto init() { - Tuple!(string, bool, bool, bool, bool, bool) t = object_notes_and_links_(""); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(""); return t; } invariant() { @@ -5571,7 +5593,7 @@ static struct ObjInlineMarkupMunge { .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") .strip; - Tuple!(string, bool, bool, bool, bool, bool) t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"], reset_note_numbers); debug(munge) { writeln(__LINE__); writeln(obj_txt_in); @@ -5598,7 +5620,7 @@ static struct ObjInlineMarkupMunge { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); - Tuple!(string, bool, bool, bool, bool, bool) t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); debug(munge) { writeln(__LINE__); writeln(obj_txt_in); @@ -5634,7 +5656,7 @@ static struct ObjInlineMarkupMunge { #+BEGIN_SRC d auto munge_group(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; - Tuple!(string, bool, bool, bool, bool, bool) t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { @@ -5654,7 +5676,7 @@ static struct ObjInlineMarkupMunge { #+BEGIN_SRC d auto munge_block()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; - Tuple!(string, bool, bool, bool, bool, bool) t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { @@ -5674,7 +5696,7 @@ static struct ObjInlineMarkupMunge { #+BEGIN_SRC d auto munge_verse()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; - Tuple!(string, bool, bool, bool, bool, bool) t = object_notes_and_links_(obj_txt["munge"]); + TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); return t; } invariant() { @@ -5749,7 +5771,7 @@ static struct ObjInlineMarkup { #+name: meta_emitters_obj_inline_markup_and_anchor_tags_and_misc #+BEGIN_SRC d - auto obj_inline_markup_and_anchor_tags_and_misc(CMM)( + TxtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( string[string] obj_, string obj_key_, CMM conf_make_meta, @@ -5829,7 +5851,7 @@ static struct ObjInlineMarkup { obj_notes_and_links["image_no_dimensions"] = x[5]; break; } - Tuple!(string, string, bool, bool, bool, bool) t = tuple( + TxtAndAnchorTagPlusHasFootnotesUrlsImages t = tuple( obj_txt["munge"], anchor_tag, obj_notes_and_links["notes_reg"], -- cgit v1.2.3