From ed302d1be74d2b4e69ee4b6e3834637ed531eaea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 24 Apr 2016 22:08:24 -0400 Subject: step1 --- lib/sdp/ao_output_debugs.d | 173 +++++++++++++++++++++++++++++++-------------- 1 file changed, 121 insertions(+), 52 deletions(-) (limited to 'lib/sdp/ao_output_debugs.d') diff --git a/lib/sdp/ao_output_debugs.d b/lib/sdp/ao_output_debugs.d index c6bdfe1..d2c2c73 100644 --- a/lib/sdp/ao_output_debugs.d +++ b/lib/sdp/ao_output_debugs.d @@ -1,9 +1,9 @@ -/* +/+ output debugs ao_output_debugs.d -*/ ++/ template SiSUoutputDebugs() { - class SDPoutputDebugs { + struct SDPoutputDebugs { auto abstract_doc_source_debugs( string[string][] contents, JSONValue[string] docmake, @@ -15,13 +15,19 @@ template SiSUoutputDebugs() { ) { mixin RgxInit; mixin ScreenTxtColors; - auto rgx = new Rgx(); + auto rgx = Rgx(); debug(parent) { - writeln(__FILE__, ":", __LINE__); + writefln( + "%s:%s", + __FILE__, + __LINE__, + ); foreach (obj; contents) { if (obj["use"] == "content") { if (obj["is"] == "heading") { - writeln(scr_txt_marker["cyan"], + writefln( + "%s%s node: %s heading: %s %s", + scr_txt_marker["cyan"], obj["ocn"], " node: ", obj["node"], " heading: ", obj["lvn"], @@ -32,15 +38,38 @@ template SiSUoutputDebugs() { } } } + debug(dumpdoc) { + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + foreach (obj; contents) { + if (obj["use"] == "content") { + writefln( + "[%s][%s]\n%s", + obj["ocn"], + obj["is"], + obj["obj"] + ); + } + } + } debug(objects) { - writeln("-------------------------------"); - writeln(__FILE__, ":", __LINE__); + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); foreach (obj; contents) { if (obj["use"] == "content") { - writeln( + writefln( + "%s* [%s][%s] %s%s", scr_txt_color["green"], - "* [", obj["ocn"], "]", - "[", obj["is"], "] ", + obj["ocn"], + obj["is"], scr_txt_color["off"], obj["obj"] ); @@ -48,17 +77,21 @@ template SiSUoutputDebugs() { } } debug(headermakejson) { - writeln("document header, metadata & make instructions:"); - writeln(dochead); - writeln(pointer_head_main); + writefln( + "%s\n%s\n%s", + "document header, metadata & make instructions:", + dochead, + pointer_head_main, + ); foreach (main_header; pointer_head_main) { switch (main_header) { case "make": foreach (sub_header; pointer_head_sub_make) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln( - main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -70,16 +103,21 @@ template SiSUoutputDebugs() { } } debug(headermetadatajson) { - writeln("document header, metadata & make instructions:"); - writeln(dochead); - writeln(pointer_head_main); + writefln( + "%s\n%s\n%s", + "document header, metadata & make instructions:", + dochead, + pointer_head_main, + ); foreach (main_header; pointer_head_main) { switch (main_header) { case "creator": foreach (sub_header; pointer_head_sub_creator) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -88,8 +126,10 @@ template SiSUoutputDebugs() { case "title": foreach (sub_header; pointer_head_sub_title) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -98,8 +138,10 @@ template SiSUoutputDebugs() { case "rights": foreach (sub_header; pointer_head_sub_rights) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -108,8 +150,10 @@ template SiSUoutputDebugs() { case "date": foreach (sub_header; pointer_head_sub_date) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -118,8 +162,10 @@ template SiSUoutputDebugs() { case "original": foreach (sub_header; pointer_head_sub_original) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -128,8 +174,10 @@ template SiSUoutputDebugs() { case "classify": foreach (sub_header; pointer_head_sub_classify) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -138,8 +186,10 @@ template SiSUoutputDebugs() { case "identifier": foreach (sub_header; pointer_head_sub_identifier) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -148,8 +198,10 @@ template SiSUoutputDebugs() { case "notes": foreach (sub_header; pointer_head_sub_notes) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -158,8 +210,10 @@ template SiSUoutputDebugs() { case "publisher": foreach (sub_header; pointer_head_sub_publisher) { if (to!string(dochead[main_header][sub_header]).length > 2) { - writeln(main_header, ":", - sub_header, ": ", + writefln( + "%s:%s: %s", + main_header, + sub_header, dochead[main_header][sub_header] ); } @@ -171,9 +225,13 @@ template SiSUoutputDebugs() { } } debug(bookindex) { - writeln("-------------------------------"); - writeln(__FILE__, ":", __LINE__); - auto bookindex = new BookIndexReport(); + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); + auto bookindex = BookIndexReport(); bookindex.bookindex_report_sorted(bookindex_unordered_hashes); } debug(summary) { @@ -190,28 +248,39 @@ template SiSUoutputDebugs() { } } debug(headings) { - writeln("-------------------------------"); - writeln(__FILE__, ":", __LINE__); + writefln( + "%s\n%s:%s", + "-------------------------------", + __FILE__, + __LINE__, + ); foreach (obj; contents) { if (obj["is"] == "heading") { - writeln( + writefln( + "%s%s~ [%s] %s", scr_txt_marker["yellow"], - obj["lev"], "~ ", - "[", obj["ocn"], "] ", + obj["lev"], + obj["ocn"], + // "[", obj["is"], "] ", obj["obj"] ); } } } - writeln( + writefln( + "%s%s%s\n%s\n%s%s\n%s%s\n%s%s\n%s:%s", scr_txt_color["green"], "-------------------------------", scr_txt_color["off"], - "\n", fn_src, - "\nlength contents array: ", contents.length, - "\nlast ocn: ", check["last_ocn"], - "\nlength bookindex: ", bookindex_unordered_hashes.length, - "\n", __FILE__, ":", __LINE__, + fn_src, + "length contents array: ", + contents.length, + "last ocn: ", + check["last_ocn"], + "length bookindex: ", + bookindex_unordered_hashes.length, + __FILE__, + __LINE__, ); debug(checkdoc) { if (auto mfn=match(fn_src, rgx.src_fn)) { -- cgit v1.2.3