From de02319cfa7b4bbff8c111bda02be1a7c6591555 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 5 Jan 2020 20:17:17 -0500 Subject: dlang safe default imminent, look ahead - @safe @trusted & @system, reconsider @trusted --- org/metaverse.org | 266 +++++++++++++++++++++++++++--------------------------- 1 file changed, 134 insertions(+), 132 deletions(-) (limited to 'org/metaverse.org') diff --git a/org/metaverse.org b/org/metaverse.org index be6c662..0483473 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -38,7 +38,7 @@ template docAbstraction() { <> <> /+ ↓ abstract marked up document +/ - auto docAbstraction(CMM,Opt,Mf) ( + @system auto docAbstraction(CMM,Opt,Mf) ( char[][] markup_sourcefile_content, CMM conf_make_meta, Opt opt_action, @@ -267,7 +267,7 @@ enum DomTags { none, open, close, close_and_open, open_still, } #+name: abs_top_init_struct #+BEGIN_SRC d -pure ObjGenericComposite obj_heading_ancestors()( +@safe pure ObjGenericComposite obj_heading_ancestors()( ObjGenericComposite obj, string[] lv_ancestors_txt, ) { @@ -326,7 +326,7 @@ pure ObjGenericComposite obj_heading_ancestors()( #+name: abs_top_init_struct #+BEGIN_SRC d -pure ObjGenericComposite obj_dom_structure_set_markup_tags()( +@safe pure ObjGenericComposite obj_dom_structure_set_markup_tags()( ObjGenericComposite obj, int[] dom, int lev @@ -376,7 +376,7 @@ pure ObjGenericComposite obj_dom_structure_set_markup_tags()( #+name: abs_top_init_struct #+BEGIN_SRC d -pure ObjGenericComposite obj_dom_set_collapsed_tags()( +@safe pure ObjGenericComposite obj_dom_set_collapsed_tags()( ObjGenericComposite obj, int[] dom, int lev @@ -426,10 +426,10 @@ pure ObjGenericComposite obj_dom_set_collapsed_tags()( #+name: abs_top_init_struct #+BEGIN_SRC d -static auto ocn_emit(int ocn_status_flag) { +@safe static auto ocn_emit(int ocn_status_flag) { return object_citation_number.ocn_emitter(ocn_status_flag); } -static auto inline_markup_faces(L)(L line) { +@safe static auto inline_markup_faces(L)(L line) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); @@ -440,7 +440,7 @@ static auto inline_markup_faces(L)(L line) { } return line; } -static string links_and_images()(string obj_txt) { +@safe static string links_and_images()(string obj_txt) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); if (obj_txt.match(rgx.smid_inline_url_generic)) { @@ -493,7 +493,7 @@ enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensio #+name: abs_inline_para_tag_associations #+BEGIN_SRC d -string[string][string] inline_para_link_anchor()( +@safe string[string][string] inline_para_link_anchor()( string[string] an_object, string[string] tag_in_seg, string[string][string] tag_assoc @@ -1744,6 +1744,7 @@ debug(bibliosection) { ***** bibliography components +#+BEGIN_SRC d JSONValue biblio_entry_tags_jsonstr = `{ "is" : "", "sortby_deemed_author_year_title" : "", @@ -1773,6 +1774,7 @@ JSONValue biblio_entry_tags_jsonstr = `{ "short_name" : "", "id" : "" }`; // is: book, article, magazine, newspaper, blog, other +#+END_SRC **** bookindex section (scroll & seg) :book:index: @@ -1955,7 +1957,7 @@ NOTE there are issues attempting to do this on first pass as: #+name: abs_post #+BEGIN_SRC d -int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { +@safe int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -2048,7 +2050,7 @@ int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { #+name: abs_post #+BEGIN_SRC d -int[] _get_ancestors_collapsed(O)(O obj, ref int[] _ancestors_collapsed) { +@safe int[] _get_ancestors_collapsed(O)(O obj, ref int[] _ancestors_collapsed) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_collapsed == 1) { _ancestors_collapsed = [ @@ -2313,7 +2315,7 @@ Build here: #+name: abs_post #+BEGIN_SRC d -auto get_decendants()(ObjGenericComposite[] document_sections) { +@safe auto get_decendants()(ObjGenericComposite[] document_sections) { int[string] _heading_ocn_decendants; string[] _ocn_open_key = ["","","","","","","",""]; auto _doc_sect_length = document_sections.length - 1; @@ -2367,7 +2369,7 @@ auto get_decendants()(ObjGenericComposite[] document_sections) { #+name: abs_post #+BEGIN_SRC d string[] _images; -string[] extract_images()(string content_block) { +@safe string[] extract_images()(string content_block) { string[] images_; if (auto m = content_block.matchAll(rgx.image)) { images_ ~= m.captures[1]; @@ -2381,7 +2383,7 @@ string[] segnames_0_to_4; #+name: abs_post #+BEGIN_SRC d -auto _image_dimensions(O,M)(O obj, M manifested) { +@system auto _image_dimensions(O,M)(O obj, M manifested) { if (obj.has.image_without_dimensions) { import std.math; import imageformats; @@ -2434,7 +2436,7 @@ auto _image_dimensions(O,M)(O obj, M manifested) { #+name: abs_post #+BEGIN_SRC d -auto _links(O)(O obj) { +@safe auto _links(O)(O obj) { if (auto m = obj.text.match(rgx.inline_link_stow_uri)) { debug(links) { writeln("number of link matches to stow: ", (obj.text.match(rgx.inline_link_stow_uri)).count); @@ -3038,7 +3040,7 @@ dom_structure_collapsed_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; #+name: abs_struct_doc_has #+BEGIN_SRC d -auto doc_has() { +@safe auto doc_has() { struct DocHas_ { uint inline_links() { return dochas["inline_links"]; @@ -3090,7 +3092,7 @@ auto doc_has() { } #+END_SRC -*** _return document tuple_ [#A] :return:tuple: +*** _return the document tuple_ [#A] :return:tuple: #+name: abs_return_tuple #+BEGIN_SRC d @@ -3110,7 +3112,7 @@ functions used in document abstraction #+name: abs_functions_object_reset #+BEGIN_SRC d -static string[string] object_reset()(string[string] an_object) @safe { +@safe static string[string] object_reset()(string[string] an_object) { an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -3124,7 +3126,7 @@ static string[string] object_reset()(string[string] an_object) @safe { #+name: abs_functions_header_set_common #+BEGIN_SRC d -void flow_common_reset_()( +@system void flow_common_reset_()( return ref int[string] line_occur, return ref string[string] an_object, return ref int[string] obj_type_status, @@ -3141,10 +3143,10 @@ void flow_common_reset_()( #+name: abs_functions_ocn_status #+BEGIN_SRC d -static int[string] _check_ocn_status_()( +@safe static int[string] _check_ocn_status_()( char[] line, int[string] obj_type_status, -) @safe { +) { static auto rgx = Rgx(); if (!(line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) @@ -3207,10 +3209,10 @@ static int[string] _check_ocn_status_()( #+name: abs_functions_substitutions #+BEGIN_SRC d -char[] _doc_header_and_make_substitutions_(CMM)( +@safe char[] _doc_header_and_make_substitutions_(CMM)( char[] line, CMM conf_make_meta, -) @safe { +) { enum Substitute { match, markup, } if (conf_make_meta.make.substitute) { foreach(substitution_pair; conf_make_meta.make.substitute) { @@ -3228,10 +3230,10 @@ char[] _doc_header_and_make_substitutions_(CMM)( #+name: abs_functions_substitutions #+BEGIN_SRC d -char[] _doc_header_and_make_substitutions_fontface_(CMM)( +@safe char[] _doc_header_and_make_substitutions_fontface_(CMM)( char[] line, CMM conf_make_meta, -) @safe { +) { enum Substitute { match, markup, } if ( conf_make_meta.make.bold) { line = line.replaceAll( @@ -3261,12 +3263,12 @@ char[] _doc_header_and_make_substitutions_fontface_(CMM)( #+name: abs_functions_block #+BEGIN_SRC d -void flow_txt_block_start()( +@safe void flow_txt_block_start()( char[] line, return ref int[string] obj_type_status, return ref uint[string] dochas, return ref string[string] object_number_poem -) @safe { +) { #+END_SRC ****** block (various) curly open :curly: @@ -3545,11 +3547,11 @@ void flow_txt_block_start()( #+name: abs_functions_block_code #+BEGIN_SRC d -void flow_txt_block_code()( +@safe void flow_txt_block_code()( char[] line, return ref string[string] an_object, return ref int[string] obj_type_status -) @safe { +) { static auto rgx = Rgx(); if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { @@ -3594,7 +3596,7 @@ void flow_txt_block_code()( #+name: abs_functions_block_biblio #+BEGIN_SRC d -final string biblio_tag_map()(string abr) { +@safe final string biblio_tag_map()(string abr) { auto btm = [ "au" : "author_raw", "ed" : "editor_raw", @@ -3646,7 +3648,7 @@ final string biblio_tag_map_()(string abr) { #+name: abs_functions_block_biblio #+BEGIN_SRC d -void flow_txt_block_biblio( +@system void flow_txt_block_biblio( char[] line, return ref int[string] obj_type_status, return ref int bib_entry, @@ -3781,11 +3783,11 @@ void flow_txt_block_biblio( #+name: abs_functions_block_quote #+BEGIN_SRC d -string[string] flow_txt_block_quote()( +@safe string[string] flow_txt_block_quote()( char[] line, string[string] an_object, return ref int[string] obj_type_status -) @safe { +) { static auto rgx = Rgx(); if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { @@ -3829,11 +3831,11 @@ string[string] flow_txt_block_quote()( #+name: abs_functions_block_group #+BEGIN_SRC d -string[string] flow_txt_block_group()( +@safe string[string] flow_txt_block_group()( char[] line, string[string] an_object, return ref int[string] obj_type_status -) @safe { +) { static auto rgx = Rgx(); if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { @@ -3878,11 +3880,11 @@ string[string] flow_txt_block_group()( #+name: abs_functions_block_block #+BEGIN_SRC d -string[string] flow_txt_block_block()( +@safe string[string] flow_txt_block_block()( char[] line, string[string] an_object, return ref int[string] obj_type_status -) @safe { +) { static auto rgx = Rgx(); if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { @@ -3925,7 +3927,7 @@ why extra object stuff only in poem/verse? #+name: abs_functions_block_poem #+BEGIN_SRC d -string[string] flow_txt_block_poem(CMM)( +@safe string[string] flow_txt_block_poem(CMM)( char[] line, string[string] an_object, return ref int[string] obj_type_status, @@ -3933,7 +3935,7 @@ string[string] flow_txt_block_poem(CMM)( string[string] object_number_poem, CMM conf_make_meta, string[string] tag_in_seg, -) @safe { +) { static auto rgx = Rgx(); if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { @@ -4189,7 +4191,7 @@ you need: #+name: abs_functions_block_table #+BEGIN_SRC d -string[string] flow_txt_block_table(CMM)( +@system string[string] flow_txt_block_table(CMM)( char[] line, string[string] an_object, return ref int[string] obj_type_status, @@ -4259,7 +4261,7 @@ process and use an_object["table_head"] (then empty it) #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d -void flow_table_closed_make_special_notation_table_(N,CMM)( +@system void flow_table_closed_make_special_notation_table_(N,CMM)( char[] line, return ref string[string] an_object, return ref ObjGenericComposite[] the_document_body_section, @@ -4308,7 +4310,7 @@ void flow_table_closed_make_special_notation_table_(N,CMM)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d -string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( +@system string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( char[] line, string[string] an_object, B bookindex_extract_hash, @@ -4666,7 +4668,7 @@ string[string] flow_block_flag_line_empty_(B,N,CMM,Ts)( #+name: abs_functions_book_index #+BEGIN_SRC d -string[string] flow_book_index_(B)( +@system string[string] flow_book_index_(B)( char[] line, string[string] an_object, return ref string book_idx_tmp, @@ -4723,13 +4725,13 @@ string[string] flow_book_index_(B)( #+name: abs_functions_heading #+BEGIN_SRC d -string[string] flow_heading_found_()( +@safe string[string] flow_heading_found_()( char[] line, string[string] heading_match_str, string[] _make_unmarked_headings, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status -) @safe { +) { static auto rgx = Rgx(); if ((_make_unmarked_headings.length > 2) && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ @@ -4810,12 +4812,12 @@ string[string] flow_heading_found_()( #+name: abs_functions_heading #+BEGIN_SRC d -char[] flow_heading_make_set_()( +@safe char[] flow_heading_make_set_()( char[] line, int[string] line_occur, return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status -) @safe { +) { if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) @@ -4872,7 +4874,7 @@ char[] flow_heading_make_set_()( #+name: abs_functions_heading #+BEGIN_SRC d -string[string] flow_heading_matched_(CMM)( +@safe string[string] flow_heading_matched_(CMM)( char[] line, string[string] an_object, return ref int[string] line_occur, @@ -4881,7 +4883,7 @@ string[string] flow_heading_matched_(CMM)( return ref int[string] collapsed_lev, return ref int[string] obj_type_status, return ref CMM conf_make_meta, -) @safe { +) { static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ ++line_occur["heading"]; @@ -5031,7 +5033,7 @@ string[string] flow_heading_matched_(CMM)( #+name: abs_functions_para #+BEGIN_SRC d -string[string] flow_para_match_()( +@safe string[string] flow_para_match_()( char[] line, string[string] an_object, return ref string an_object_key, @@ -5039,7 +5041,7 @@ string[string] flow_para_match_()( return ref bool bullet, return ref int[string] obj_type_status, return ref int[string] line_occur, -) @safe { +) { static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); @@ -5090,9 +5092,9 @@ string[string] flow_para_match_()( #+name: abs_functions_para #+BEGIN_SRC d -char[] font_faces_line()( +@safe char[] font_faces_line()( char[] textline, -) @safe { +) { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); if (textline.match(rgx.inline_faces_line)) { @@ -5127,10 +5129,10 @@ char[] font_faces_line()( #+name: abs_functions_table #+BEGIN_SRC d -ObjGenericComposite flow_table_instructions(H)( +@safe ObjGenericComposite flow_table_instructions(H)( return ref ObjGenericComposite table_object, H table_head, -) @safe { +) { static auto rgx = Rgx(); table_object.metainfo.is_of_part = "body"; table_object.metainfo.is_of_section = "body"; @@ -5158,10 +5160,10 @@ ObjGenericComposite flow_table_instructions(H)( #+name: abs_functions_table #+BEGIN_SRC d -ObjGenericComposite flow_table_array_munge(T)( +@safe ObjGenericComposite flow_table_array_munge(T)( return ref ObjGenericComposite table_object, return ref T table_array, -) @safe { +) { static auto rgx = Rgx(); static auto mng = InlineMarkup(); string _table_substantive; @@ -5288,7 +5290,7 @@ ObjGenericComposite flow_table_array_munge(T)( #+name: abs_functions_table #+BEGIN_SRC d -ObjGenericComposite flow_table_substantive_munge(T)( +@system ObjGenericComposite flow_table_substantive_munge(T)( return ref ObjGenericComposite table_object, return ref T table_substantive, ) { @@ -5310,7 +5312,7 @@ ObjGenericComposite flow_table_substantive_munge(T)( #+name: abs_functions_table #+BEGIN_SRC d -ObjGenericComposite flow_table_substantive_munge_special(T)( +@system ObjGenericComposite flow_table_substantive_munge_special(T)( return ref ObjGenericComposite table_object, return ref T table_substantive, ) { @@ -5334,11 +5336,11 @@ ObjGenericComposite flow_table_substantive_munge_special(T)( #+name: meta_emitters_ocn #+BEGIN_SRC d -pure struct OCNemitter { +@safe pure struct OCNemitter { int ocn_digit, ocn_object_number, ocn_on_, ocn_off_, ocn_bkidx, ocn_bkidx_; string object_identifier; bool ocn_is_off; - auto ocn_emitter(int ocn_status_flag) @safe { + @safe auto ocn_emitter(int ocn_status_flag) { OCNset ocn; assert(ocn_status_flag <= OCNstatus.reset); ocn_object_number = ocn_bkidx = 0; @@ -5390,7 +5392,7 @@ pure struct OCNemitter { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d -static struct ObjInlineMarkupMunge { +@safe static struct ObjInlineMarkupMunge { string[string] obj_txt; int n_foot, n_foot_reg, n_foot_sp_asterisk, n_foot_sp_plus; string asterisks_, plus_; @@ -5398,7 +5400,7 @@ static struct ObjInlineMarkupMunge { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; - private auto initialize_note_numbers() @safe { + private auto initialize_note_numbers() { n_foot = 0; n_foot_reg = 0; n_foot_sp_asterisk = 0; @@ -5408,7 +5410,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - static auto images()(string obj_txt_in) @safe { + @safe static auto images()(string obj_txt_in) { static auto mng = InlineMarkup(); /+ url matched +/ obj_txt_in = obj_txt_in.replaceAll(rgx.inline_notes_al_special, ""); // TODO reinstate when special footnotes are implemented @@ -5444,7 +5446,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - TxtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) @safe { + @safe TxtPlusHasFootnotes footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { /+ endnotes (regular) +/ bool flg_notes_reg = false; bool flg_notes_star = false; @@ -5514,10 +5516,10 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - private TxtPlusHasFootnotesUrlsImages object_notes_and_links_()( + @safe private TxtPlusHasFootnotesUrlsImages object_notes_and_links_()( string obj_txt_in, bool reset_note_numbers=false - ) @safe { + ) { obj_txt_out = ""; bool urls = false; bool images_without_dimensions = false; @@ -5585,10 +5587,10 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_heading()( + @safe auto munge_heading()( string obj_txt_in, bool reset_note_numbers=false - ) @safe { + ) { obj_txt["munge"] = obj_txt_in .replaceFirst(rgx.heading, "") .replaceFirst(rgx.object_number_off_all, "") @@ -5616,7 +5618,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_para()(string obj_txt_in) @safe { + @safe auto munge_para()(string obj_txt_in) { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); @@ -5635,7 +5637,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_quote()(string obj_txt_in) @safe { + @safe string munge_quote()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5654,7 +5656,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_group(string obj_txt_in) @safe { + @safe auto munge_group(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5674,7 +5676,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_block()(string obj_txt_in) @safe { + @safe auto munge_block()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5694,7 +5696,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_verse()(string obj_txt_in) @safe { + @safe auto munge_verse()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; TxtPlusHasFootnotesUrlsImages t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5713,7 +5715,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_code()(string obj_txt_in) @safe { + @safe string munge_code()(string obj_txt_in) { obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); obj_txt["munge"] = obj_txt_in; return obj_txt["munge"]; @@ -5728,7 +5730,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_table()(string obj_txt_in) @safe { + @safe string munge_table()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5740,7 +5742,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_comment()(string obj_txt_in) @safe { + @safe string munge_comment()(string obj_txt_in) { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5771,12 +5773,12 @@ static struct ObjInlineMarkup { #+name: meta_emitters_obj_inline_markup_and_anchor_tags_and_misc #+BEGIN_SRC d - TxtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( + @safe TxtAndAnchorTagPlusHasFootnotesUrlsImages obj_inline_markup_and_anchor_tags_and_misc(CMM)( string[string] obj_, string obj_key_, CMM conf_make_meta, Flag!"_new_doc" _new_doc - ) @safe { + ) { obj_txt["munge"] = obj_[obj_key_].dup; obj_txt["munge"] = (obj_["is"].match(ctRegex!(`verse|code`))) ? obj_txt["munge"] @@ -5870,23 +5872,23 @@ static struct ObjInlineMarkup { #+name: meta_emitters_obj_inline_markup_table_of_contents #+BEGIN_SRC d - auto _clean_heading_toc_()( + @safe auto _clean_heading_toc_()( char[] heading_toc_, - ) @safe { + ) { auto m = (cast(char[]) heading_toc_).matchFirst(rgx.heading); heading_toc_ = (m.post).replaceAll( rgx.inline_notes_curly_gen, ""); return heading_toc_; }; - ObjGenericComposite[] flow_table_of_contents_gather_headings(CMM)( + @safe ObjGenericComposite[] flow_table_of_contents_gather_headings(CMM)( string[string] obj_, CMM conf_make_meta, string[string] tag_in_seg, string _anchor_tag, return ref string[][string] lev4_subtoc, ObjGenericComposite[] the_table_of_contents_section, - ) @safe { + ) { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; static auto mkup = InlineMarkup(); @@ -5982,12 +5984,12 @@ private: static string heading_number_auto_composite = ""; static string heading_number_auto_composite_segname = ""; static bool[] auto_heading_numbering = [ true, true, true, true]; - static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)( + @safe static string _configured_auto_heading_numbering_and_segment_anchor_tags(CMM)( string munge_, string[string] obj_, CMM conf_make_meta, bool _new_doc, - ) @safe { + ) { if (_new_doc) { heading_num = [ 0, 0, 0, 0 ]; heading_number_auto_composite = ""; @@ -6132,11 +6134,11 @@ private: #+name: meta_emitters_obj_inline_markup_heading_numbering_segment_anchor_tags #+BEGIN_SRC d static int heading_num_lev1 = 0; - static string _make_segment_anchor_tags_if_none_provided()( + @safe static string _make_segment_anchor_tags_if_none_provided()( string munge_, string lev_, bool _new_doc - ) @safe { + ) { if (!(munge_.match(rgx.heading_anchor_tag))) { if (munge_.match(rgx.heading_identify_anchor_tag)) { if (auto m = munge_.match(rgx.heading_extract_named_anchor_tag)) { @@ -6187,11 +6189,11 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_public #+BEGIN_SRC d - string obj_attributes()( + @safe string obj_attributes()( string obj_is_, string obj_raw, ObjGenericComposite _comp_obj_heading, - ) @safe { + ) { scope(exit) { destroy(obj_is_); destroy(obj_raw); @@ -6262,7 +6264,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para_and_blocks()(string obj_txt_in) { + @safe string txt_para_and_blocks()(string obj_txt_in) { if (obj_txt_in.matchFirst(rgx.para_bullet)) { _obj_attributes =" \"bullet\": \"true\"," ~ " \"indent_hang\": 0," @@ -6292,7 +6294,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_heading()(string obj_txt_in) @safe { + @safe string txt_heading()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"heading\""; @@ -6306,7 +6308,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para()(string obj_txt_in) @safe { + @safe string txt_para()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"para\""; @@ -6320,7 +6322,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_quote()(string obj_txt_in) @safe { + @safe string txt_quote()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"quote\""; @@ -6334,7 +6336,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_group()(string obj_txt_in) @safe { + @safe string txt_group()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"group\""; @@ -6348,7 +6350,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_block()(string obj_txt_in) @safe { + @safe string txt_block()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"block\""; @@ -6362,7 +6364,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_verse()(string obj_txt_in) @safe { + @safe string txt_verse()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"verse\""; @@ -6376,7 +6378,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_code()(string obj_txt_in) @safe { + @safe string txt_code()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"code\""; @@ -6390,7 +6392,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_table()(string obj_txt_in) @safe { + @safe string txt_table()(string obj_txt_in) { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"table\""; @@ -6404,7 +6406,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_comment()(string obj_txt_in) @safe { + @safe string txt_comment()(string obj_txt_in) { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," ~ " \"is\": \"comment\""; @@ -6418,11 +6420,11 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_json #+BEGIN_SRC d - string _set_additional_values_parse_as_json()( + @safe string _set_additional_values_parse_as_json()( string _obj_attrib, string obj_is_, ObjGenericComposite _comp_obj_heading, - ) @safe { + ) { JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) @@ -6461,11 +6463,11 @@ struct BookIndexNuggetHash { string[] object_numbers; string[][string][string] bi_hash_nugget; string[] bi_main_terms_split_arr; - string[][string][string] bookindex_nugget_hash(N,S)( + @safe string[][string][string] bookindex_nugget_hash(N,S)( string bookindex_section, N obj_cite_digits, S tag_in_seg, - ) @safe { + ) { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -6537,9 +6539,9 @@ struct BookIndexNuggetHash { #+BEGIN_SRC d struct BookIndexReportIndent { int mkn, skn; - void bookindex_report_indented()( + @safe void bookindex_report_indented()( string[][string][string] bookindex_unordered_hashes - ) @safe { + ) { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { @@ -6578,9 +6580,9 @@ struct BookIndexReportSection { #+name: meta_emitters_book_index_report_section #+BEGIN_SRC d - void bookindex_write_section()( + @safe void bookindex_write_section()( string[][string][string] bookindex_unordered_hashes - ) @safe { + ) { auto mainkeys = bookindex_unordered_hashes.byKey.array .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; @@ -6613,7 +6615,7 @@ struct BookIndexReportSection { #+name: meta_emitters_book_index_report_section #+BEGIN_SRC d - auto bookindex_build_abstraction_section(N,B)( + @system auto bookindex_build_abstraction_section(N,B)( string[][string][string] bookindex_unordered_hashes, N obj_cite_digits, B opt_action, @@ -6794,11 +6796,11 @@ struct NotesSection { #+name: meta_emitters_endnotes #+BEGIN_SRC d - private auto gather_notes_for_endnote_section( + @safe private auto gather_notes_for_endnote_section( ObjGenericComposite[] contents_am, string[string] tag_in_seg, int cntr, - ) @safe { + ) { assert((contents_am[cntr].metainfo.is_a == "para") || (contents_am[cntr].metainfo.is_a == "heading") || (contents_am[cntr].metainfo.is_a == "quote") @@ -6880,7 +6882,7 @@ struct NotesSection { #+name: meta_emitters_endnotes #+BEGIN_SRC d - private auto gathered_notes() @safe { + @safe private auto gathered_notes() { string[][string] endnotes_; if (object_notes.length > 1) { endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -6897,10 +6899,10 @@ struct NotesSection { #+name: meta_emitters_endnotes #+BEGIN_SRC d - private auto endnote_objects(N,O)( + @safe private auto endnote_objects(N,O)( N obj_cite_digits, O opt_action, - ) @safe { + ) { mixin spineNode; ObjGenericComposite[] the_endnotes_section; auto endnotes_ = gathered_notes(); @@ -7028,7 +7030,7 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - public JSONValue[] flow_bibliography_()( +@system public JSONValue[] flow_bibliography_()( return ref string[] biblio_unsorted_incomplete, return ref JSONValue[] bib_arr_json ) { @@ -7059,7 +7061,7 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - final private JSONValue[] biblio_make_unsorted_array_of_json_objects()( + @system final private JSONValue[] biblio_make_unsorted_array_of_json_objects()( string[] biblio_unordered, JSONValue[] bib_arr_json ) { @@ -7093,7 +7095,7 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - final private JSONValue[] biblio_sort()(JSONValue[] biblio_unordered) { + @system final private JSONValue[] biblio_sort()(JSONValue[] biblio_unordered) { JSONValue[] biblio_sorted_; biblio_sorted_ = sort!((a, b){ @@ -7114,7 +7116,7 @@ struct Bibliography { #+name: meta_emitters_bibliography #+BEGIN_SRC d - void biblio_debug()(JSONValue[] biblio_sorted) { + @system void biblio_debug()(JSONValue[] biblio_sorted) { debug(biblio0) { foreach (j; biblio_sorted) { if (!empty(j["fulltitle"].str)) { @@ -7148,7 +7150,7 @@ struct NodeStructureMetadata { #+name: meta_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_location_emitter(La,Ta,N)( + @safe ObjGenericComposite node_location_emitter(La,Ta,N)( string lev_markup_number, string[string] tag_in_seg, La lev_anchor_tag, @@ -7157,7 +7159,7 @@ struct NodeStructureMetadata { int cntr_, int ptr_, string is_ - ) @safe { + ) { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -7208,7 +7210,7 @@ struct NodeStructureMetadata { #+name: meta_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_emitter_heading(Hd,TaL,TA,N,fNr,fNs,fL)( + @safe ObjGenericComposite node_emitter_heading(Hd,TaL,TA,N,fNr,fNs,fL)( string _text, string lev_markup_number, string lev_collapsed_number, @@ -7225,7 +7227,7 @@ struct NodeStructureMetadata { fNr flag_notes_reg, fNs flag_notes_star, fL flag_links, - ) @safe { + ) { debug(asserts) { static assert(is(typeof(lev) == string)); static assert(is(typeof(obj_cite_digits.object_number) == int)); @@ -7418,10 +7420,10 @@ struct NodeStructureMetadata { #+name: abs_functions_assertions #+BEGIN_SRC d -pure void assertions_doc_structure()( +@safe pure void assertions_doc_structure()( string[string] an_object, int[string] lv -) @safe { +) { if (lv["h3"] > State.off) { assert(lv["h0"] > State.off); assert(lv["h1"] > State.off); @@ -7599,7 +7601,7 @@ pure void assertions_doc_structure()( #+name: abs_functions_assertions #+BEGIN_SRC d -pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) @safe { +@safe pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) { assert( (obj_type_status["code"] == TriState.off) || (obj_type_status["code"] == TriState.closing), @@ -7628,7 +7630,7 @@ pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_ty #+name: template_doc_sect_keys_seq #+BEGIN_SRC d template docSectKeysSeq() { - auto docSectKeysSeq(string[][string] document_section_keys_sequenced) @safe { + @safe auto docSectKeysSeq(string[][string] document_section_keys_sequenced) { struct doc_sect_keys_seq { string[] scroll() { return document_section_keys_sequenced["scroll"]; @@ -7704,22 +7706,22 @@ struct DocObj_MetaInfo_ { int o_n_bibliography = 0; int o_n_book_index = 0; int o_n_blurb = 0; - string object_number_substantive() const @property { + @safe string object_number_substantive() const @property { return (o_n_substantive==0) ? "" : o_n_substantive.to!string; } - string object_number_non_substantive() const @property { + @safe string object_number_non_substantive() const @property { return (o_n_non_substantive==0) ? "" : o_n_non_substantive.to!string; } - string object_number_glossary() const @property { + @safe string object_number_glossary() const @property { return (o_n_glossary==0) ? "" : o_n_glossary.to!string; } - string object_number_bibliography() const @property { + @safe string object_number_bibliography() const @property { return (o_n_bibliography==0) ? "" : o_n_bibliography.to!string; } - string object_number_book_index() const @property { + @safe string object_number_book_index() const @property { return (o_n_book_index==0) ? "" : o_n_book_index.to!string; } - string object_number_blurb() const @property { + @safe string object_number_blurb() const @property { return (o_n_blurb==0) ? "" : o_n_blurb.to!string; } bool object_number_off = false; @@ -7729,13 +7731,13 @@ struct DocObj_MetaInfo_ { string[string][string] node; int ocn = 0; string identifier = ""; - string object_number() const @property { + @safe string object_number() const @property { return (ocn==0) ? "" : ocn.to!string; } int o_n_type = 0; int heading_lev_markup = 9; int heading_lev_collapsed = 9; - string marked_up_level() const @property { + @safe string marked_up_level() const @property { string _out; switch (heading_lev_markup) { case 0 : _out = "A"; break; -- cgit v1.2.3