diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2020-01-05 20:17:17 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-02-11 13:08:49 -0500 |
commit | de02319cfa7b4bbff8c111bda02be1a7c6591555 (patch) | |
tree | 732c11d10bc2699cd1b72d00b3be943284eea130 /org/in_source_files.org | |
parent | reduce use of auto, much with tuples (diff) |
dlang safe default imminent, look ahead
- @safe @trusted & @system, reconsider @trusted
Diffstat (limited to 'org/in_source_files.org')
-rw-r--r-- | org/in_source_files.org | 60 |
1 files changed, 20 insertions, 40 deletions
diff --git a/org/in_source_files.org b/org/in_source_files.org index 7ea9bae..a498688 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -51,7 +51,7 @@ static template readConfigSite() { doc_reform.meta.rgx; <<imports_std>> mixin spineRgxInit; - final auto readConfigSite(C)(C _conf_file_details) { + @system final auto readConfigSite(C)(C _conf_file_details) { static auto rgx = Rgx(); string conf_filename = "NONE"; string config_file_str; @@ -158,7 +158,7 @@ static template readConfigDoc() { doc_reform.meta.rgx; <<imports_std>> mixin spineRgxInit; - final auto readConfigDoc(M,E)(M _manifested, E _env) { + @system final auto readConfigDoc(M,E)(M _manifested, E _env) { static auto rgx = Rgx(); string config_file_str; string conf_filename = "NONE"; @@ -185,13 +185,13 @@ static template readConfigDoc() { if (config_file_str.length > 0) { break; } } struct _ConfContent { - string filename() { + @safe string filename() { return conf_filename; } - string content() { + @safe string content() { return config_file_str; } - string filetype() { + @safe string filetype() { string _ft = ""; if (content.match(rgx.yaml_config)) { _ft = "yaml"; @@ -204,33 +204,13 @@ static template readConfigDoc() { } #+END_SRC -*** 1. YAML config files get - -#+name: meta_config_file_yaml -#+BEGIN_SRC d -static template configYAML() { - import dyaml; // - <<imports_std>> - YAMLDocument configYAML(string configuration, string conf_yaml_filename) { - Node _yaml_conf; - try { - _yaml_conf = Loader.fromString(configuration).load() - } catch(ErrnoException e) { - stderr.writeln("Yaml problem with content for ", conf_yaml_filename); - stderr.writeln(e.msg); - } - return _yaml_conf; - } -} -#+END_SRC - -*** 2. YAML config (config_local_site & dr_document_make) :file:config:hub: +*** YAML config (config_local_site & dr_document_make) :file:config:hub: #+name: meta_config_file_hub #+BEGIN_SRC d static template configReadSiteYAML() { <<imports_std>> - final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { + @safe final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInSiteYAML!()(_manifested, _env); auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); string _conf_yaml_fn = _conf_file_details.config_filename_site; @@ -240,7 +220,7 @@ static template configReadSiteYAML() { } static template configReadDocYAML() { <<imports_std>> - final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { + @safe final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInDocYAML!()(_manifested, _env); auto _conf_file_details = ConfigFilePaths!()(_manifested, _env); string _conf_yaml_fn = _conf_file_details.config_filename_document; @@ -267,7 +247,7 @@ static template spineRawMarkupContent() { mixin spineRgxInit; static auto rgx = Rgx(); string[] _images=[]; - string[] _extract_images(S)(S content_block) @safe { + @safe string[] _extract_images(S)(S content_block) { string[] images_; string _content_block = content_block.to!string; if (auto m = _content_block.matchAll(rgx.image)) { @@ -287,19 +267,19 @@ static template spineRawMarkupContent() { string[], "insert_files", string[], "images" ); - auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) @safe { + @safe auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) { auto _0_header_1_body_content_2_insert_filelist_tuple = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src); return _0_header_1_body_content_2_insert_filelist_tuple; } struct RawMarkupContent { - final sourceContent(in string fn_src) { + @safe final sourceContent(in string fn_src) { auto raw = MarkupRawUnit(); string source_txt_str = raw.markupSourceReadIn(fn_src); return source_txt_str; } - final auto sourceContentSplitIntoHeaderAndBody(O)( + @safe final auto sourceContentSplitIntoHeaderAndBody(O)( O _opt_action, in string source_txt_str, in string fn_src="" @@ -348,7 +328,7 @@ static template spineRawMarkupContent() { char[][], "insert_contents", string[], "images" ); - ContentsAndImages scan_subdoc_source(O)( + @safe ContentsAndImages scan_subdoc_source(O)( O _opt_action, char[][] markup_sourcefile_insert_content, string fn_src @@ -360,7 +340,7 @@ static template spineRawMarkupContent() { } // end src subdoc (inserts) loop <<meta_inserts_scan_post>> } - ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)( + @safe ContentsInsertsImages scan_master_src_for_insert_files_and_import_content(O)( O _opt_action, char[][] sourcefile_body_content, string fn_src @@ -382,7 +362,7 @@ static template spineRawMarkupContent() { #+name: meta_markup_source_raw_read_file_source_string #+BEGIN_SRC d -final private string readInMarkupSource(in char[] fn_src) { +@safe final private string readInMarkupSource(in char[] fn_src) { enforce( exists(fn_src) != 0, "file not found: «" ~ @@ -414,7 +394,7 @@ split is on first match of level A~ (which is required) #+name: meta_markup_source_raw_doc_header_and_content_split #+BEGIN_SRC d -final private char[][] header0Content1(in string src_text) @trusted { // cast(char[]) +@trusted final private char[][] header0Content1(in string src_text) { // cast(char[]) /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/ char[][] header_and_content; auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a); @@ -433,7 +413,7 @@ final private char[][] header0Content1(in string src_text) @trusted { // cast(ch #+name: meta_markup_source_raw_source_line_array #+BEGIN_SRC d -final private char[][] markupSourceLineArray(in char[] src_text) @trusted { // cast(char[]) +@trusted final private char[][] markupSourceLineArray(in char[] src_text) { // cast(char[]) char[][] source_line_arr = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding); return source_line_arr; @@ -448,7 +428,7 @@ final private char[][] markupSourceLineArray(in char[] src_text) @trusted { // c #+name: meta_markup_source_raw_read_in_file #+BEGIN_SRC d -string markupSourceReadIn(in string fn_src) { +@safe string markupSourceReadIn(in string fn_src) { static auto rgx = Rgx(); enforce( fn_src.match(rgx.src_pth_sst_or_ssm), @@ -469,7 +449,7 @@ string markupSourceReadIn(in string fn_src) { #+name: meta_markup_source_raw_tuple_of_header_and_body #+BEGIN_SRC d -HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) @safe { +@safe HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) { string[] file_insert_list = []; string[] images_list = []; char[][] hc = header0Content1(source_txt_str); @@ -490,7 +470,7 @@ HeaderContentInsertsImages markupSourceHeaderContentRawLineTupleArray(in string #+name: meta_markup_source_raw_get_insert_source_line_array #+BEGIN_SRC d -final char[][] getInsertMarkupSourceContentRawLineArray( +@safe final char[][] getInsertMarkupSourceContentRawLineArray( in char[] fn_src_insert, Regex!(char) rgx_file ) { |