From 9a91485c10e059dee1374e152e4b068cd9d3866c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 5 Dec 2019 11:41:09 -0500 Subject: 0.9.2 @safe & @trusted first pass --- org/metaverse.org | 118 +++++++++++++++++++++++++++--------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'org/metaverse.org') diff --git a/org/metaverse.org b/org/metaverse.org index 538e12b..f184d9e 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -38,7 +38,7 @@ template docAbstraction() { <> <> /+ ↓ abstract marked up document +/ - auto docAbstraction(CMM,Opt,Mf)( + auto docAbstraction(CMM,Opt,Mf) ( char[][] markup_sourcefile_content, CMM conf_make_meta, Opt opt_action, @@ -3075,7 +3075,7 @@ functions used in document abstraction #+name: abs_functions_object_reset #+BEGIN_SRC d -static string[string] object_reset()(string[string] an_object) { +static string[string] object_reset()(string[string] an_object) @safe { an_object.remove("body_nugget"); an_object.remove("substantive"); an_object.remove("is"); @@ -3109,7 +3109,7 @@ void flow_common_reset_()( 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) @@ -3175,7 +3175,7 @@ static int[string] _check_ocn_status_()( 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) { @@ -3196,7 +3196,7 @@ char[] _doc_header_and_make_substitutions_(CMM)( 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( @@ -3231,7 +3231,7 @@ void flow_txt_block_start()( 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: @@ -3514,7 +3514,7 @@ 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)) { @@ -3750,7 +3750,7 @@ 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)) { @@ -3798,7 +3798,7 @@ 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)) { @@ -3847,7 +3847,7 @@ 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)) { @@ -3898,7 +3898,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)) { @@ -4694,7 +4694,7 @@ string[string] flow_heading_found_()( 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 +/ @@ -4780,7 +4780,7 @@ char[] flow_heading_make_set_()( 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)) @@ -4846,7 +4846,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"]; @@ -5004,7 +5004,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); @@ -5057,7 +5057,7 @@ string[string] flow_para_match_()( #+BEGIN_SRC d char[] font_faces_line()( char[] textline, -) { +) @safe { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); if (textline.match(rgx.inline_faces_line)) { @@ -5087,7 +5087,7 @@ char[] font_faces_line()( 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"; @@ -5118,7 +5118,7 @@ ObjGenericComposite flow_table_instructions(H)( 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; @@ -5295,7 +5295,7 @@ 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) { + auto ocn_emitter(int ocn_status_flag) @safe { OCNset ocn; assert(ocn_status_flag <= OCNstatus.reset); ocn_object_number = ocn_bkidx = 0; @@ -5355,7 +5355,7 @@ static struct ObjInlineMarkupMunge { static auto rgx = Rgx(); static auto mkup = InlineMarkup(); int stage_reset_note_numbers = true; - private auto initialize_note_numbers() { + private auto initialize_note_numbers() @safe { n_foot = 0; n_foot_reg = 0; n_foot_sp_asterisk = 0; @@ -5365,7 +5365,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - static auto images()(string obj_txt_in) { + static auto images()(string obj_txt_in) @safe { 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 @@ -5401,7 +5401,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto footnotes_endnotes_markup_and_number_or_stars()(string obj_txt_in, bool reset_note_numbers) { + auto 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; @@ -5474,7 +5474,7 @@ static struct ObjInlineMarkupMunge { private auto 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; @@ -5545,7 +5545,7 @@ static struct ObjInlineMarkupMunge { 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, "") @@ -5573,7 +5573,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_para()(string obj_txt_in) { + auto munge_para()(string obj_txt_in) @safe { obj_txt["munge"]=(obj_txt_in) .replaceFirst(rgx.para_attribs, "") .replaceFirst(rgx.object_number_off_all, ""); @@ -5592,7 +5592,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_quote()(string obj_txt_in) { + string munge_quote()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5611,7 +5611,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_group(string obj_txt_in) { + auto munge_group(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5631,7 +5631,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_block()(string obj_txt_in) { + auto munge_block()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5651,7 +5651,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - auto munge_verse()(string obj_txt_in) { + auto munge_verse()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; auto t = object_notes_and_links_(obj_txt["munge"]); return t; @@ -5670,7 +5670,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_code()(string obj_txt_in) { + string munge_code()(string obj_txt_in) @safe { obj_txt_in = obj_txt_in.replaceAll(rgx.space, mkup.nbsp); obj_txt["munge"] = obj_txt_in; return obj_txt["munge"]; @@ -5685,7 +5685,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_table()(string obj_txt_in) { + string munge_table()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5697,7 +5697,7 @@ static struct ObjInlineMarkupMunge { #+name: meta_emitters_obj_inline_markup_munge #+BEGIN_SRC d - string munge_comment()(string obj_txt_in) { + string munge_comment()(string obj_txt_in) @safe { obj_txt["munge"]=obj_txt_in; return obj_txt["munge"]; } @@ -5733,7 +5733,7 @@ static struct ObjInlineMarkup { 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"] @@ -5829,7 +5829,7 @@ static struct ObjInlineMarkup { #+BEGIN_SRC d 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, @@ -5843,7 +5843,7 @@ static struct ObjInlineMarkup { 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(); @@ -5938,7 +5938,7 @@ private: string[string] obj_, CMM conf_make_meta, bool _new_doc, - ) { + ) @safe { if (_new_doc) { heading_num = [ 0, 0, 0, 0 ]; heading_number_auto_composite = ""; @@ -6087,7 +6087,7 @@ private: 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)) { @@ -6142,7 +6142,7 @@ struct ObjAttributes { string obj_is_, string obj_raw, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { scope(exit) { destroy(obj_is_); destroy(obj_raw); @@ -6243,7 +6243,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_heading()(string obj_txt_in) { + string txt_heading()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"heading\""; @@ -6257,7 +6257,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_para()(string obj_txt_in) { + string txt_para()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"para\"," ~ " \"is\": \"para\""; @@ -6271,7 +6271,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_quote()(string obj_txt_in) { + string txt_quote()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"quote\""; @@ -6285,7 +6285,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_group()(string obj_txt_in) { + string txt_group()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"group\""; @@ -6299,7 +6299,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_block()(string obj_txt_in) { + string txt_block()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"block\""; @@ -6313,7 +6313,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_verse()(string obj_txt_in) { + string txt_verse()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"verse\""; @@ -6327,7 +6327,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_code()(string obj_txt_in) { + string txt_code()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"code\""; @@ -6341,7 +6341,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_table()(string obj_txt_in) { + string txt_table()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"content\"," ~ " \"of\": \"block\"," ~ " \"is\": \"table\""; @@ -6355,7 +6355,7 @@ struct ObjAttributes { #+name: meta_emitters_obj_attributes_private_an_attribute #+BEGIN_SRC d - string txt_comment()(string obj_txt_in) { + string txt_comment()(string obj_txt_in) @safe { _obj_attributes = " \"use\": \"comment\"," ~ " \"of\": \"comment\"," ~ " \"is\": \"comment\""; @@ -6373,7 +6373,7 @@ struct ObjAttributes { string _obj_attrib, string obj_is_, ObjGenericComposite _comp_obj_heading, - ) { + ) @safe { JSONValue oa_j = parseJSON(_obj_attrib); assert( (oa_j.type == JSON_TYPE.OBJECT) @@ -6416,7 +6416,7 @@ struct BookIndexNuggetHash { string bookindex_section, N obj_cite_digits, S tag_in_seg, - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -6490,7 +6490,7 @@ struct BookIndexReportIndent { int mkn, skn; void bookindex_report_indented()( string[][string][string] bookindex_unordered_hashes - ) { + ) @safe { auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; foreach (mainkey; mainkeys) { @@ -6531,7 +6531,7 @@ struct BookIndexReportSection { #+BEGIN_SRC d 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; @@ -6749,7 +6749,7 @@ struct NotesSection { 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") @@ -6831,7 +6831,7 @@ struct NotesSection { #+name: meta_emitters_endnotes #+BEGIN_SRC d - private auto gathered_notes() { + private auto gathered_notes() @safe { string[][string] endnotes_; if (object_notes.length > 1) { endnotes_["notes"] = (object_notes["notes"].split(rgx.break_string))[0..$-1]; @@ -6851,7 +6851,7 @@ struct NotesSection { private auto endnote_objects(N,O)( N obj_cite_digits, O opt_action, - ) { + ) @safe { mixin spineNode; ObjGenericComposite[] the_endnotes_section; auto endnotes_ = gathered_notes(); @@ -7108,7 +7108,7 @@ struct NodeStructureMetadata { int cntr_, int ptr_, string is_ - ) { + ) @safe { debug(asserts) { static assert(is(typeof(obj_cite_digits.object_number) == int)); } @@ -7176,7 +7176,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)); @@ -7372,7 +7372,7 @@ struct NodeStructureMetadata { 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); @@ -7550,7 +7550,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) { +pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) @safe { assert( (obj_type_status["code"] == TriState.off) || (obj_type_status["code"] == TriState.closing), @@ -7579,7 +7579,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) { + auto docSectKeysSeq(string[][string] document_section_keys_sequenced) @safe { struct doc_sect_keys_seq { string[] scroll() { return document_section_keys_sequenced["scroll"]; -- cgit v1.2.3