diff options
| author | Ralph Amissah <ralph@amissah.com> | 2015-09-30 13:07:43 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2015-09-30 13:12:21 -0400 | 
| commit | 45e96028ce7696381aca7f155c21b0b718b6a610 (patch) | |
| tree | eefcf5737cffc0d457bc433cd41ba21579076ff2 /lib/sdp/ao_output_debugs.d | |
sdp, abstract objects, a start
Diffstat (limited to 'lib/sdp/ao_output_debugs.d')
| -rw-r--r-- | lib/sdp/ao_output_debugs.d | 354 | 
1 files changed, 354 insertions, 0 deletions
| diff --git a/lib/sdp/ao_output_debugs.d b/lib/sdp/ao_output_debugs.d new file mode 100644 index 0000000..abc48b3 --- /dev/null +++ b/lib/sdp/ao_output_debugs.d @@ -0,0 +1,354 @@ +/* +#+OPTIONS: ^:nil _:nil#+OPTIONS: ^:nil _:nil +* sdp_output_debugs.d +*/ +template SiSUoutputDebugs() { +  class SDPoutputDebugs { +    auto abstract_doc_source_debugs( +      string[string][] contents, +      JSONValue[string] docmake, +      JSONValue[string] dochead, +      string[][string][string] bookindex_unordered_hashes, +      JSONValue[] biblio, +      string fn_src, +      string[string] actions +    ) { +      mixin RgxInit; +      mixin ScreenTxtColors; +      auto rgx = new Rgx(); +      debug(parent) { +        writeln(__FILE__, ":", __LINE__); +        foreach (obj; contents) { +          if (obj["use"] == "content") { +            if (obj["is"] == "heading") { +              writeln(scr_txt_marker["cyan"], +                obj["ocn"], +                " node: ", obj["node"], +                " heading: ", obj["lvn"], +                " ", obj["obj"], +              ); +            } else { +            } +          } +        } +      } +      debug(objects) { +        writeln("-------------------------------"); +        writeln(__FILE__, ":", __LINE__); +        foreach (obj; contents) { +          if (obj["use"] == "content") { +            writeln( +              scr_txt_color["green"], +              "* [", obj["ocn"], "]", +              "[", obj["is"], "] ", +              scr_txt_color["off"], +              obj["obj"] +            ); +          } +        } +      } +      debug(headermakejson) { +        writeln("document header, metadata & make instructions:"); +        writeln(dochead); +        writeln(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, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          default: +            break; +          } +        } +      } +      debug(headermetadatajson) { +        writeln("document header, metadata & make instructions:"); +        writeln(dochead); +        writeln(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, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "title": +            foreach (sub_header; pointer_head_sub_title) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "rights": +            foreach (sub_header; pointer_head_sub_rights) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "date": +            foreach (sub_header; pointer_head_sub_date) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "original": +            foreach (sub_header; pointer_head_sub_original) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "classify": +            foreach (sub_header; pointer_head_sub_classify) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "identifier": +            foreach (sub_header; pointer_head_sub_identifier) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "notes": +            foreach (sub_header; pointer_head_sub_notes) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          case "publisher": +            foreach (sub_header; pointer_head_sub_publisher) { +              if (to!string(dochead[main_header][sub_header]).length > 2) { +                writeln(main_header, ":", +                  sub_header, ": ", +                  dochead[main_header][sub_header] +                ); +              } +            } +            break; +          default: +            break; +          } +        } +      } +      debug(bookindex) { +        writeln("-------------------------------"); +        writeln(__FILE__, ":", __LINE__); +        auto bookindex = new BookIndexReport(); +        bookindex.bookindex_report_sorted(bookindex_unordered_hashes); +      } +      debug(summary) { +        string[string] check = [ +          "last_ocn" : "NA [debug \"checkdoc\" not run]", +        ]; +        debug(checkdoc) { +          foreach (obj; contents) { +            if (obj["use"] == "content") { +              if (!empty(obj["ocn"])) { +                check["last_ocn"] = obj["ocn"]; +              } +            } +          } +        } +        debug(headings) { +          writeln("-------------------------------"); +          writeln(__FILE__, ":", __LINE__); +          foreach (obj; contents) { +            if (obj["is"] == "heading") { +              writeln( +                scr_txt_marker["yellow"], +                obj["lev"], "~ ", +                "[", obj["ocn"], "] ", +                obj["obj"] +              ); +            } +          } +        } +        writeln( +          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__, +        ); +        debug(checkdoc) { +          if (auto mfn=match(fn_src, rgx.src_fn)) { +            if (actions["assert"] == "yes") { +              switch (mfn.captures[2]) { +              case "live-manual.ssm": +                assert(check["last_ocn"] == +                  "1019","last ocn should be: 1019 (check test, document is frequently updated)"); // ok +                break; +              case "sisu_markup.sst": +                assert(check["last_ocn"] == +                  "297","last ocn should be: 297"); // ok +                // assert(check["last_ocn"] == "297","last ocn should be: 297"); +                // notes for first divergance study sisu headings 247 250 +                // sisu has issue with code that contains heading 1~ which results in no ocn! ?? +                // sisu currently has incorrect last body ocn of 294! +                // bug in sisu? attend +                break; +              // sisu-markup-samples: +              case "accelerando.charles_stross.sst": +                assert(check["last_ocn"] == +                  "2861","last ocn should be: 2861"); // ok +                break; +              case "alices_adventures_in_wonderland.lewis_carroll.sst": +                assert(check["last_ocn"] == +                  "805","last ocn should be: 805"); // 808 +                break; +              case "autonomy_markup0.sst": +                assert(check["last_ocn"] == +                  "77","last ocn should be: 77"); // ok endnotes +                // assert(check["last_ocn"] == "78","last ocn should be: 78"); +                break; +              case "content.cory_doctorow.sst": +                assert(check["last_ocn"] == +                  "953","last ocn should be: 953"); // 1007 way off, check ocn off switches +                // assert(check["last_ocn"] == "953","last ocn should be: 953"); +                break; +              case "democratizing_innovation.eric_von_hippel.sst": +                // fixed ERROR! range violation, broken check! endnotes, bookindex, biblio +                // error in bookindex ... (ch1; ch6; ch8 ) +                assert(check["last_ocn"] == +                  "905","last ocn should be: 905"); // 911 +                break; +              case "down_and_out_in_the_magic_kingdom.cory_doctorow.sst": +                assert(check["last_ocn"] == +                  "1417","last ocn should be: 1417"); // 1455 check ocn off switches +                break; +              case "for_the_win.cory_doctorow.sst": +                assert(check["last_ocn"] == +                  "3510","last ocn should be: 3510"); // 3569 check ocn off switches +                break; +              case "free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst": +                assert(check["last_ocn"] == +                  "1082","last ocn should be: 1082"); // check 1079 too few +                break; +              case "free_culture.lawrence_lessig.sst": +                assert(check["last_ocn"] == +                  "1330","last ocn should be: 1330"); // 1312 +                // fixed ERROR! range violation, broken check! +                // error in bookindex ... sections piracy (ch1) & property (ch10 market concentration) fixed +                break; +              case "free_for_all.peter_wayner.sst": // endnotes, bookindex, biblio +                assert(check["last_ocn"] == +                  "1559","last ocn should be: 1559"); // 1560, check ocn off switches, has endnotes so 2 too many +                // assert(check["last_ocn"] == "1559","last ocn should be: 1559"); +                break; +              case "gpl2.fsf.sst": +                assert(check["last_ocn"] == +                  "65","last ocn should be: 65"); // ok endnotes? check +                // assert(check["last_ocn"] == "66","last ocn should be: 66"); +                break; +              case "gpl3.fsf.sst": +                assert(check["last_ocn"] == +                  "123","last ocn should be: 123"); // ok +                break; +              case "gullivers_travels.jonathan_swift.sst": +                assert(check["last_ocn"] == +                  "668","last ocn should be: 668"); // 674 +                break; +              case "little_brother.cory_doctorow.sst": +                assert(check["last_ocn"] == +                  "3130","last ocn should be: 3130"); // 3204, check ocn off switches +                break; +              case "the_cathedral_and_the_bazaar.eric_s_raymond.sst": +                assert(check["last_ocn"] == +                  "258","last ocn should be: 258"); // ok +                break; +              case "the_public_domain.james_boyle.sst": +                assert(check["last_ocn"] == +                  "970","last ocn should be: 970"); // 978 +                break; +              case "the_wealth_of_networks.yochai_benkler.sst": // endnotes, bookindex +                assert(check["last_ocn"] == +                  "829","last ocn should be: 829"); // ok +                // assert(check["last_ocn"] == "832","last ocn should be: 832"); +                // has endnotes and bookindex, issue with sisu.rb +                break; +              case "through_the_looking_glass.lewis_carroll.sst": +                assert(check["last_ocn"] == +                  "949","last ocn should be: 949"); // 955 +                break; +              case "two_bits.christopher_kelty.sst": // endnotes, bookindex, biblio +                assert(check["last_ocn"] == +                  "1190","last ocn should be: 1190"); // 1191 +                // assert(check["last_ocn"] == "1193","last ocn should be: 1193"); // 1191 ok? +                // has endnotes and bookindex, issue with sisu.rb +                break; +                // fixed ERROR! range violation! +                // error in bookindex ... (ch3 the movement) +                break; +              case "un_contracts_international_sale_of_goods_convention_1980.sst": +                assert(check["last_ocn"] == +                  "377","last ocn should be: 377"); // ok +                break; +              case "viral_spiral.david_bollier.sst": // endnotes, bookindex +                assert(check["last_ocn"] == +                  "1078","last ocn should be: 1078"); // 1100 +                // fixed ERROR! range violation! +                // error in bookindex ... (ch7 ... building the cc machine, an extra semi colon) +                break; +              // case ".sst": +              //   assert(check["last_ocn"] == "0","last ocn should be: 0"); +              //   break; +              // case ".sst": +              //   assert(check["last_ocn"] == "0","last ocn should be: 0"); +              //   break; +              // case ".sst": +              //   assert(check["last_ocn"] == "0","last ocn should be: 0"); +              //   break; +              default: +                writeln(fn_src); +                break; +              } +            } +          } +        } +      } +    } +  } +} | 
