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 --- src/doc_reform/spine.d | 116 ++++++++++++++++++++++++------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) (limited to 'src/doc_reform/spine.d') diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 8108acb..39ea058 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -86,7 +86,7 @@ name "spine" description "A SiSU inspired document parser writen in D." homepage "http://sisudoc.org" +/ -void main(string[] args) { +@system void main(string[] args) { mixin spineRgxInit; mixin contentJSONtoSpineStruct; mixin spineBiblio; @@ -244,16 +244,16 @@ void main(string[] args) { } enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff } struct OptActions { - bool assertions() @trusted { + @trusted bool assertions() { return opts["assertions"]; } - bool concordance() @trusted { + @trusted bool concordance() { return opts["concordance"]; } auto config_path_set() { return settings["config"]; } - bool css_theme_default() @trusted { + @trusted bool css_theme_default() { bool _is_light; if (opts["light"] || opts["theme-light"]) { _is_light = true; @@ -264,94 +264,94 @@ void main(string[] args) { } return _is_light; } - bool debug_do() @trusted { + @trusted bool debug_do() { return opts["debug"]; } - bool digest() @trusted { + @trusted bool digest() { return opts["digest"]; } - bool epub() @trusted { + @trusted bool epub() { return opts["epub"]; } - bool harvest_link() @trusted { + @trusted bool harvest_link() { return (opts["harvest-link"]) ? true : false; } - bool harvest() @trusted { + @trusted bool harvest() { return (opts["harvest"] || opts["harvest-authors"] || opts["harvest-topics"]) ? true : false; } - bool harvest_authors() @trusted { + @trusted bool harvest_authors() { return (opts["harvest"] || opts["harvest-authors"]) ? true : false; } - bool harvest_topics() @trusted { + @trusted bool harvest_topics() { return (opts["harvest"] || opts["harvest-topics"]) ? true : false; } - bool html() @trusted { + @trusted bool html() { return (opts["html"] || opts["html-seg"] || opts["html-scroll"]) ? true : false; } - bool html_seg() @trusted { + @trusted bool html_seg() { return (opts["html"] || opts["html-seg"]) ? true : false; } - bool html_scroll() @trusted { + @trusted bool html_scroll() { return (opts["html"] || opts["html-scroll"]) ? true : false; } - bool html_stuff() @trusted { + @trusted bool html_stuff() { return (opts["html"] || opts["html-scroll"] || opts["html-seg"]) ? true : false; } - bool latex() @trusted { + @trusted bool latex() { return (opts["latex"] || opts["pdf"]) ? true : false; } - bool odt() @trusted { + @trusted bool odt() { return (opts["odf"] || opts["odt"]) ? true : false; } - bool manifest() @trusted { + @trusted bool manifest() { return opts["manifest"]; } - bool ocn_hidden() @trusted { + @trusted bool ocn_hidden() { return opts["hide-ocn"]; } - bool ocn_off() @trusted { + @trusted bool ocn_off() { return opts["ocn-off"]; } - bool quiet() @trusted { + @trusted bool quiet() { return opts["quiet"]; } - bool pod() @trusted { + @trusted bool pod() { return opts["pod"]; } - bool show_summary() @trusted { + @trusted bool show_summary() { return opts["show-summary"]; } - bool show_make() @trusted { + @trusted bool show_make() { return opts["show-make"]; } - bool show_metadata() @trusted { + @trusted bool show_metadata() { return opts["show-metadata"]; } - bool show_config() @trusted { + @trusted bool show_config() { return opts["show-config"]; } - bool source() @trusted { + @trusted bool source() { return opts["source"]; } - bool source_or_pod() @trusted { + @trusted bool source_or_pod() { return (opts["pod"] || opts["source"]) ? true : false; } - bool sqlite_discrete() @trusted { + @trusted bool sqlite_discrete() { return opts["sqlite-discrete"]; } - bool sqlite_db_drop() @trusted { + @trusted bool sqlite_db_drop() { return (opts["sqlite-db-recreate"] || opts["sqlite-db-drop"]) ? true : false; } - bool sqlite_db_create() @trusted { + @trusted bool sqlite_db_create() { return (opts["sqlite-db-recreate"] || opts["sqlite-db-create"]) ? true : false; } - bool sqlite_delete() @trusted { + @trusted bool sqlite_delete() { return opts["sqlite-delete"]; } - bool sqlite_update() @trusted { + @trusted bool sqlite_update() { return (opts["sqlite-update"] || opts["sqlite-insert"]) ? true : false; } - bool sqlite_shared_db_action() @trusted { + @trusted bool sqlite_shared_db_action() { return ( opts["sqlite-db-recreate"] || opts["sqlite-db-create"] @@ -360,46 +360,46 @@ void main(string[] args) { || opts["sqlite-update"] ) ? true : false; } - bool text() @trusted { + @trusted bool text() { return opts["text"]; } - bool verbose() @trusted { + @trusted bool verbose() { return (opts["verbose"] || opts["very-verbose"]) ? true : false; } - bool very_verbose() @trusted { + @trusted bool very_verbose() { return opts["very-verbose"]; } - bool xhtml() @trusted { + @trusted bool xhtml() { return opts["xhtml"]; } - bool section_toc() @trusted { + @trusted bool section_toc() { return opts["section_toc"]; } - bool section_body() @trusted { + @trusted bool section_body() { return opts["section_body"]; } - bool section_endnotes() @trusted { + @trusted bool section_endnotes() { return opts["section_endnotes"]; } - bool section_glossary() @trusted { + @trusted bool section_glossary() { return opts["section_glossary"]; } - bool section_biblio() @trusted { + @trusted bool section_biblio() { return opts["section_biblio"]; } - bool section_bookindex() @trusted { + @trusted bool section_bookindex() { return opts["section_bookindex"]; } - bool section_blurb() @trusted { + @trusted bool section_blurb() { return opts["section_blurb"]; } - bool backmatter() @trusted { + @trusted bool backmatter() { return opts["backmatter"]; } - bool skip_output() @trusted { + @trusted bool skip_output() { return opts["skip-output"]; } - bool workon() @trusted { + @trusted bool workon() { return opts["workon"]; } auto languages_set() { @@ -411,7 +411,7 @@ void main(string[] args) { auto sqlite_filename() { return settings["sqlite-filename"]; } - bool parallelise() @trusted { + @trusted bool parallelise() { bool _is; if (opts["parallel"] == true) { _is = true; @@ -435,7 +435,7 @@ void main(string[] args) { } else { _is = false; } return _is; } - bool parallelise_subprocesses() @trusted { + @trusted bool parallelise_subprocesses() { return opts["parallel-subprocesses"]; } auto output_task_scheduler() { @@ -466,7 +466,7 @@ void main(string[] args) { } return schedule.sort().uniq; } - bool abstraction() @trusted { + @trusted bool abstraction() { return ( opts["abstraction"] || concordance @@ -482,7 +482,7 @@ void main(string[] args) { || sqlite_update ) ? true : false; } - bool meta_processing_general() @trusted { + @trusted bool meta_processing_general() { return ( opts["abstraction"] || html @@ -493,7 +493,7 @@ void main(string[] args) { || sqlite_update ) ? true :false; } - bool meta_processing_xml_dom() @trusted { + @trusted bool meta_processing_xml_dom() { return ( opts["abstraction"] || html @@ -505,20 +505,20 @@ void main(string[] args) { } } auto _opt_action = OptActions(); - auto program_info() { + @safe auto program_info() { struct ProgramInfo { - string project() { + @safe string project() { return project_name; } - string name() { + @safe string name() { return program_name; } - string ver() { + @safe string ver() { return format("%s.%s.%s", _ver.major, _ver.minor, _ver.patch, ); } - string compiler() { + @safe string compiler() { return format ("%s D:%s, %s %s", __VENDOR__, __VERSION__, bits, os, -- cgit v1.2.3