From e9e17be24eba558c30fcdc41ea5bb9a1da7fd4e7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 12 Mar 2024 22:39:09 -0400 Subject: mark modules as @safe: (& identify what is not) --- org/spine.org | 66 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 32 deletions(-) (limited to 'org/spine.org') diff --git a/org/spine.org b/org/spine.org index cd6960b..30585a6 100644 --- a/org/spine.org +++ b/org/spine.org @@ -47,6 +47,7 @@ name "spine" description "A SiSU inspired document parser written in D." homepage "https://sisudoc.org" +/ +@safe: <> <> <> @@ -965,20 +966,20 @@ OptActions _opt_action = OptActions(); #+NAME: spine_args_program_info #+BEGIN_SRC d -@safe auto program_info() { +auto program_info() { struct ProgramInfo { - @safe string project() { + string project() { return project_name; } - @safe string name() { + string name() { return program_name; } - @safe string ver() { + string ver() { return format("%s.%s.%s", _ver.major, _ver.minor, _ver.patch, ); } - @safe string compiler() { + string compiler() { return format ("%s D:%s, %s %s", __VENDOR__, __VERSION__, bits, os, @@ -990,7 +991,7 @@ OptActions _opt_action = OptActions(); @trusted string name_version_and_compiler() { return format("%s-%s (%s)", name, ver, compiler); } - @safe auto time_output_generated() { + auto time_output_generated() { auto _st = Clock.currTime(UTC()); auto _t = TimeOfDay(_st.hour, _st.minute, _st.second); auto _time = _st.year.to!string @@ -1458,6 +1459,7 @@ break; // terminate, stop #+BEGIN_SRC d <> module doc_reform.meta.metadoc; +@safe: template spineAbstraction() { <> <> @@ -1643,15 +1645,15 @@ struct DocumentMatters { #+NAME: spine_each_file_do_document_matters_1_detail_program_time #+BEGIN_SRC d -@safe auto generator_program() { +auto generator_program() { struct Prog_ { - @safe string project_name() { + string project_name() { return "spine"; } - @safe string name() { + string name() { return program_info.name; } - @safe string ver() { + string ver() { return program_info.ver; } @trusted string name_and_version() { @@ -1660,22 +1662,22 @@ struct DocumentMatters { @trusted string name_version_and_compiler() { return program_info.name_version_and_compiler; } - @safe string url_home() { + string url_home() { return "https://sisudoc.org"; } - @safe string url_git() { + string url_git() { return "https://git.sisudoc.org/projects/"; } - @safe auto compiler() { + auto compiler() { return program_info.compiler; } - @safe auto time_output_generated() { + auto time_output_generated() { return program_info.time_output_generated; } } return Prog_(); } -@safe auto generated_time() { +auto generated_time() { auto _st = Clock.currTime(UTC()); auto _time = _st.year.to!string ~ "-" ~ _st.month.to!int.to!string // prefer as month number @@ -1692,10 +1694,10 @@ struct DocumentMatters { #+NAME: spine_each_file_do_document_matters_2_meta #+BEGIN_SRC d -@safe auto conf_make_meta() { +auto conf_make_meta() { return _make_and_meta_struct; } -@safe auto has() { +auto has() { return _doc_has_struct; } #+END_SRC @@ -1704,12 +1706,12 @@ struct DocumentMatters { #+NAME: spine_each_file_do_document_matters_3_env #+BEGIN_SRC d -@safe auto env() { +auto env() { struct Env_ { - @safe auto pwd() { + auto pwd() { return _manifest.env.pwd; } - @safe auto home() { + auto home() { return _manifest.env.home; } } @@ -1721,9 +1723,9 @@ struct DocumentMatters { #+NAME: spine_each_file_do_document_matters_4_opt #+BEGIN_SRC d -@safe auto opt() { +auto opt() { struct Opt_ { - @safe auto action() { + auto action() { /+ getopt options, commandline instructions, raw - processing instructions --epub --html etc. - command line config instructions --output @@ -1739,18 +1741,18 @@ struct DocumentMatters { #+NAME: spine_each_file_do_document_matters_5_doc #+BEGIN_SRC d -@safe auto src() { +auto src() { return _manifest.src; } -@safe auto src_path_info() { +auto src_path_info() { return spinePathsSRC!()(_manifest.env.pwd, _manifest.src.file_with_absolute_path); // would like (to have and use) relative path } -@safe auto pod() { +auto pod() { return _manifest.pod; } -@safe auto sqlite() { +auto sqlite() { struct SQLite_ { - @safe string filename() { + string filename() { string _fn = ""; string _pth = ""; if (_opt_action.sqliteDB_filename.length > 0) { @@ -1760,7 +1762,7 @@ struct DocumentMatters { } return _fn; } - @safe string path() { + string path() { string _pth = ""; if (_opt_action.sqliteDB_path.length > 0) { _pth = _opt_action.sqliteDB_path; @@ -1769,7 +1771,7 @@ struct DocumentMatters { } return _pth; } - @safe string cgi_filename() { + string cgi_filename() { string _fn = ""; if (_opt_action.cgi_sqlite_search_filename.length > 0) { _fn = _opt_action.cgi_sqlite_search_filename; @@ -1778,7 +1780,7 @@ struct DocumentMatters { } return _fn; } - @safe string cgi_filename_d() { + string cgi_filename_d() { string _fn = ""; if (_opt_action.cgi_sqlite_search_filename_d.length > 0) { _fn = _opt_action.cgi_sqlite_search_filename_d; @@ -1790,10 +1792,10 @@ struct DocumentMatters { } return SQLite_(); } -@safe auto output_path() { +auto output_path() { return _make_and_meta_struct.conf.output_path; } -@safe auto srcs() { +auto srcs() { struct SRC_ { auto file_insert_list() { return _header_body_insertfilelist_imagelist[headBody.insert_file_list]; -- cgit v1.2.3