LCOV - code coverage report
Current view: top level - io/source/document - document_element_writer.c (source / functions) Hit Total Coverage
Test: crystal-facet-uml_v1.61.0_covts Lines: 0 840 0.0 %
Date: 2024-10-26 21:44:38 Functions: 0 31 0.0 %

          Line data    Source code
       1             : /* File: document_element_writer.c; Copyright and License: see below */
       2             : 
       3             : #include "document/document_element_writer.h"
       4             : #include "utf8stringbuf/utf8string.h"
       5             : #include "entity/data_id.h"
       6             : #include "u8/u8_trace.h"
       7             : #include "u8/u8_log.h"
       8             : #include <stdio.h>
       9             : #include <stdbool.h>
      10             : #include <assert.h>
      11             : 
      12             : /* GENERAL STRUCTURE */
      13             : 
      14             : /*
      15             :  *    <THING>_START
      16             :  *    <THING>_MIDDLE            #optional, if dynamic content needs to be added to the start
      17             :  *    <THING>_TITLE_START       #alternative to TITLE: NAME
      18             :  *    <THING>_TITLE_END         #alternative to TITLE: NAME
      19             :  *    ...                       #optional text
      20             :  *    <THING>_<OTHERSUB>_START  #optional if there ore other sub-things
      21             :  *    <THING>_<OTHERSUB>_END    #optional if there ore other sub-things
      22             :  *    <THING>_END
      23             :  */
      24             : 
      25             : /* IO_FILE_FORMAT_DOCBOOK */
      26             : 
      27             : #define DOCUMENT_ELEMENT_WRITER_LEFT_POINTING_GUILLEMENTS "\xc2\xab"
      28             : #define DOCUMENT_ELEMENT_WRITER_RIGHT_POINTING_GUILLEMENTS "\xc2\xbb"
      29             : 
      30             : static const char DOCBOOK_ENC[]
      31             :     = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
      32             : static const char DOCBOOK_DOC_START[]
      33             :     = "\n<book xmlns=\"http://docbook.org/ns/docbook\" version=\"5.0\" xml:lang=\"en\">";
      34             : static const char DOCBOOK_DOC_TITLE_START[]
      35             :     = "\n<title>";
      36             : static const char DOCBOOK_DOC_TITLE_END[]
      37             :     = "</title>";
      38             : static const char DOCBOOK_DOC_END[]
      39             :     = "\n</book>\n";
      40             : 
      41             : static const char DOCBOOK_TOP_DIAGRAM_START[]
      42             :     = "\n<chapter xml:id=\"";
      43             : static const char DOCBOOK_TOP_DIAGRAM_MIDDLE[]
      44             :     = "\">";
      45             : static const char DOCBOOK_TOP_DIAGRAM_END[]
      46             :     = "\n</chapter>";
      47             : static const char DOCBOOK_DIAGRAM_START[]
      48             :     = "\n<section xml:id=\"";
      49             : static const char DOCBOOK_DIAGRAM_MIDDLE[]
      50             :     = "\">";
      51             : static const char DOCBOOK_DIAGRAM_TITLE_START[]
      52             :     = "\n<title>";
      53             : static const char DOCBOOK_DIAGRAM_TITLE_END[]
      54             :     = "</title>";
      55             : static const char DOCBOOK_DIAGRAM_IMG_START[]
      56             :     = "\n<para>"
      57             :       "\n    <mediaobject>"
      58             :       "\n        <imageobject><imagedata fileref=\"";
      59             : static const char DOCBOOK_DIAGRAM_IMG_MIDDLE[]
      60             :     = ".pdf\" width=\"12cm\"/></imageobject>"
      61             :       "\n        <imageobject><imagedata fileref=\"";
      62             : static const char DOCBOOK_DIAGRAM_IMG_END[]
      63             :     = ".png\"/></imageobject>"
      64             :       "\n    </mediaobject>"
      65             :       "\n</para>";
      66             : static const char DOCBOOK_DIAGRAM_END[]
      67             :     = "\n</section>";
      68             : 
      69             : static const char DOCBOOK_DESCRIPTION_START[]
      70             :     = "\n<para>";
      71             : static const char DOCBOOK_DESCRIPTION_MIDDLE[]  /* optional */
      72             :     = "\n</para>"
      73             :       "\n<para>";
      74             : static const char DOCBOOK_DESCRIPTION_XREF_START[]
      75             :     = "<xref linkend=\"";
      76             : static const char DOCBOOK_DESCRIPTION_XREF_MIDDLE[]
      77             :     = "\"/>: ";
      78             : static const char DOCBOOK_DESCRIPTION_XREF_END[]
      79             :     = "";
      80             : static const char DOCBOOK_DESCRIPTION_END[]
      81             :     = "\n</para>";
      82             : 
      83             : static const char DOCBOOK_ELEMENT_LIST_START[]
      84             :     = "\n<variablelist>";
      85             : static const char DOCBOOK_ELEMENT_START[]
      86             :     = "\n<varlistentry>";
      87             : static const char DOCBOOK_ELEMENT_NAME_START[]
      88             :     = "\n<term>";
      89             : static const char DOCBOOK_ELEMENT_NAME_END[]
      90             :     = "</term>"
      91             :       "\n<listitem>";
      92             : static const char DOCBOOK_ELEMENT_ATTRIBUTES_START[]
      93             :     = "\n<para>";
      94             : static const char DOCBOOK_ELEMENT_STEREO_START[]
      95             :     = "\n" DOCUMENT_ELEMENT_WRITER_LEFT_POINTING_GUILLEMENTS;
      96             : static const char DOCBOOK_ELEMENT_STEREO_END[]
      97             :     = DOCUMENT_ELEMENT_WRITER_RIGHT_POINTING_GUILLEMENTS;
      98             : static const char DOCBOOK_ELEMENT_ID_START[]
      99             :     = "\n<token>";
     100             : static const char DOCBOOK_ELEMENT_ID_END[]
     101             :     = "</token>";
     102             : static const char DOCBOOK_ELEMENT_SEE_START[] = "\n<emphasis>(appears in ";
     103             : static const char DOCBOOK_ELEMENT_SEE_NEXT[] = ",\n";
     104             : static const char DOCBOOK_ELEMENT_SEE_MORE[] = ", ...";
     105             : static const char DOCBOOK_ELEMENT_SEE_END[] = ")\n</emphasis>";
     106             : static const char DOCBOOK_ELEMENT_ATTRIBUTES_END[]
     107             :     = "\n</para>";
     108             : static const char DOCBOOK_ELEMENT_DESCR_START[]  /* optional */
     109             :     = "\n<para>";
     110             : static const char DOCBOOK_ELEMENT_DESCR_END[]  /* optional */
     111             :     = "\n</para>";
     112             : static const char DOCBOOK_ELEMENT_END[]
     113             :     = "\n    </listitem>"
     114             :       "\n</varlistentry>";
     115             : static const char DOCBOOK_ELEMENT_LIST_END[]
     116             :     = "\n</variablelist>";
     117             : 
     118             : /* IO_FILE_FORMAT_HTML */
     119             : 
     120             : enum HTML_DIAGRAM_MAX { HTML_DIAGRAM_MAX_DEPTH = 6, };
     121             : static const char HTML_DTD[]
     122             :     = "<!DOCTYPE html>";
     123             : static const char HTML_DOC_START[]
     124             :     = "\n<html>";
     125             : static const char HTML_HEAD_START[]
     126             :     = "\n<head>"
     127             :       "\n    <meta charset=\"UTF-8\" />";
     128             :       /* "\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />"; < old */
     129             : static const char HTML_HEAD_TITLE_START[]
     130             :     = "\n<title>";
     131             : static const char HTML_HEAD_TITLE_END[]
     132             :     = "</title>";
     133             : static const char HTML_HEAD_CSS_START[]
     134             :     = "\n<link rel=\"stylesheet\" type=\"text/css\" href=\"";
     135             : static const char HTML_HEAD_CSS_END[]
     136             :     = ".css\" />";
     137             : static const char HTML_HEAD_END[]
     138             :     = "\n</head>";
     139             : static const char HTML_BODY_START[]
     140             :     = "\n<body>";
     141             : static const char HTML_HEADER[]
     142             :     = "\n<header></header>";
     143             : static const char HTML_NAV_START[]
     144             :     = "\n<nav>";
     145             : static const char HTML_NAV_END[]
     146             :     = "\n</nav>";
     147             : static const char HTML_ARTICLE_START[]
     148             :     = "\n<main>"
     149             :       "\n<article>";
     150             : static const char HTML_ARTICLE_END[]
     151             :     = "\n</article>"
     152             :       "\n</main>";
     153             : static const char HTML_FOOTER[]
     154             :     = "\n<footer></footer>";
     155             : static const char HTML_BODY_END[]
     156             :     = "\n</body>";
     157             : static const char HTML_DOC_END[]
     158             :     = "\n</html>\n";
     159             : static const char HTML_TOC_SUBLIST_START[]
     160             :     = "\n<ul class=\"toc\">";
     161             : static const char *HTML_TOC_SUBLIST_ENTRY_START[HTML_DIAGRAM_MAX_DEPTH]
     162             :     = {
     163             :       "\n<li class=\"toc1\">",
     164             :       "\n<li class=\"toc2\">",
     165             :       "\n<li class=\"toc3\">",
     166             :       "\n<li class=\"toc4\">",
     167             :       "\n<li class=\"toc5\">",
     168             :       "\n<li class=\"toc6\">"
     169             :       };
     170             : static const char HTML_TOC_SUBLIST_ENTRY_TITLE_START[]
     171             :     = "\n<a href=\"#";
     172             : static const char HTML_TOC_SUBLIST_ENTRY_TITLE_MIDDLE[]
     173             :     = "\">";
     174             : static const char HTML_TOC_SUBLIST_ENTRY_TITLE_END[]
     175             :     = "</a>";
     176             : static const char HTML_TOC_SUBLIST_ENTRY_END[]
     177             :     = "\n</li>";
     178             : static const char HTML_TOC_SUBLIST_END[]
     179             :     = "\n</ul>";
     180             : 
     181             : static const char *HTML_DIAGRAM_TITLE_START[HTML_DIAGRAM_MAX_DEPTH]
     182             :     = {
     183             :       "\n\n<h1 id=\"",
     184             :       "\n\n<h2 id=\"",
     185             :       "\n\n<h3 id=\"",
     186             :       "\n\n<h4 id=\"",
     187             :       "\n\n<h5 id=\"",
     188             :       "\n\n<h6 id=\""
     189             :       };
     190             : static const char HTML_DIAGRAM_TITLE_MIDDLE[]
     191             :     = "\" class=\"diag-title\">";
     192             : static const char *HTML_DIAGRAM_TITLE_END[HTML_DIAGRAM_MAX_DEPTH]
     193             :     = {
     194             :       "</h1>",
     195             :       "</h2>",
     196             :       "</h3>",
     197             :       "</h4>",
     198             :       "</h5>",
     199             :       "</h6>"
     200             :       };
     201             : static const char HTML_DIAGRAM_IMG_START[]
     202             :     = "\n<div class=\"mediaobject\"><img src=\"";
     203             : static const char HTML_DIAGRAM_IMG_END[]
     204             :     = ".png\" width=\"840\" alt=\"\" /></div>";
     205             : 
     206             : static const char HTML_ANY_DESCR_NEWLINE[]
     207             :     = "\n<br />\n";
     208             : static const char HTML_ANY_DESCR_XREF_START[]
     209             :     = "<a href=\"#";
     210             : static const char HTML_ANY_DESCR_XREF_MIDDLE[]
     211             :     = "\">";
     212             : static const char HTML_ANY_DESCR_XREF_END[]
     213             :     = "</a>";
     214             : 
     215             : static const char HTML_DIAG_START[] = "\n<div class=\"diag\">";
     216             : static const char HTML_DIAG_HEAD_START[] = "\n<p>";
     217             : static const char HTML_DIAG_NAME_START[] = "\n<strong class=\"diag-name\">";
     218             : static const char HTML_DIAG_NAME_END[] = "</strong>";
     219             : static const char HTML_DIAG_STEREO_START[] = "\n<em class=\"diag-stereo\">";
     220             : static const char HTML_DIAG_STEREO_END[] = "</em>";
     221             : static const char HTML_DIAG_TYPE_START[] = "\n<em class=\"diag-type\">";
     222             : static const char HTML_DIAG_TYPE_END[] = "</em>";
     223             : static const char HTML_DIAG_ID_START[] = "\n<em class=\"diag-id\">";
     224             : static const char HTML_DIAG_ID_END[] = "</em>";
     225             : static const char HTML_DIAG_HEAD_END[] = "\n</p>";
     226             : static const char HTML_DIAG_DESCR_START[] = "\n<p class=\"diag-descr\">\n";
     227             : static const char HTML_DIAG_DESCR_END[] = "\n</p>";
     228             : static const char HTML_DIAG_END[] = "\n</div>";
     229             : 
     230             : static const char HTML_CLAS_START[] = "\n<div class=\"clas\">";
     231             : static const char HTML_CLAS_HEAD_START[] = "\n<p>";
     232             : static const char HTML_CLAS_NAME_START[] = "\n<strong class=\"clas-name\">";
     233             : static const char HTML_CLAS_NAME_END[] = "</strong>";
     234             : static const char HTML_CLAS_STEREO_START[] = "\n<em class=\"clas-stereo\">";
     235             : static const char HTML_CLAS_STEREO_END[] = "</em>";
     236             : static const char HTML_CLAS_TYPE_START[] = "\n<em class=\"clas-type\">";
     237             : static const char HTML_CLAS_TYPE_END[] = "</em>";
     238             : static const char HTML_CLAS_ID_START[] = "\n<em class=\"clas-id\">";
     239             : static const char HTML_CLAS_ID_END[] = "</em>";
     240             : static const char HTML_CLAS_HEAD_END[] = "\n</p>";
     241             : static const char HTML_CLAS_SEE_START[] = "\n<p class=\"clas-see\">\n";
     242             : static const char HTML_CLAS_SEE_NEXT[] = ",\n";
     243             : static const char HTML_CLAS_SEE_MORE[] = ", ...";
     244             : static const char HTML_CLAS_SEE_END[] = "\n</p>";
     245             : static const char HTML_CLAS_DESCR_START[] = "\n<p class=\"clas-descr\">\n";
     246             : static const char HTML_CLAS_DESCR_END[] = "\n</p>";
     247             : static const char HTML_CLAS_END[] = "\n</div>";
     248             : 
     249             : static const char HTML_FEAT_START[] = "\n<div class=\"feat\">";
     250             : static const char HTML_FEAT_HEAD_START[] = "\n<p>";
     251             : static const char HTML_FEAT_NAME_START[] = "\n<strong class=\"feat-name\">";
     252             : static const char HTML_FEAT_NAME_END[] = "</strong>";
     253             : static const char HTML_FEAT_STEREO_START[] = "\n<em class=\"feat-stereo\">";
     254             : static const char HTML_FEAT_STEREO_END[] = "</em>";
     255             : static const char HTML_FEAT_VALUE_START[] = "\n<em class=\"feat-value\">";
     256             : static const char HTML_FEAT_VALUE_END[] = "</em>";
     257             : static const char HTML_FEAT_TYPE_START[] = "\n<em class=\"feat-type\">";
     258             : static const char HTML_FEAT_TYPE_END[] = "</em>";
     259             : static const char HTML_FEAT_ID_START[] = "\n<em class=\"feat-id\">";
     260             : static const char HTML_FEAT_ID_END[] = "</em>";
     261             : static const char HTML_FEAT_HEAD_END[] = "\n</p>";
     262             : static const char HTML_FEAT_DESCR_START[] = "\n<p class=\"feat-descr\">\n";
     263             : static const char HTML_FEAT_DESCR_END[] = "\n</p>";
     264             : static const char HTML_FEAT_END[] = "\n</div>";
     265             : 
     266             : static const char HTML_REL_START[] = "\n<div class=\"rel\">";
     267             : static const char HTML_REL_HEAD_START[] = "\n<p>";
     268             : static const char HTML_REL_NAME_START[] = "\n<strong class=\"rel-name\">";
     269             : static const char HTML_REL_NAME_END[] = "</strong>";
     270             : static const char HTML_REL_DEST_START[] = "\n<strong class=\"rel-dest\">";
     271             : static const char HTML_REL_DEST_END[] = "</strong>";
     272             : static const char HTML_REL_STEREO_START[] = "\n<em class=\"rel-stereo\">";
     273             : static const char HTML_REL_STEREO_END[] = "</em>";
     274             : static const char HTML_REL_TYPE_START[] = "\n<em class=\"rel-type\">";
     275             : static const char HTML_REL_TYPE_END[] = "</em>";
     276             : static const char HTML_REL_ID_START[] = "\n<em class=\"rel-id\">";
     277             : static const char HTML_REL_ID_END[] = "</em>";
     278             : static const char HTML_REL_HEAD_END[] = "\n</p>";
     279             : static const char HTML_REL_DESCR_START[] = "\n<p class=\"rel-descr\">\n";
     280             : static const char HTML_REL_DESCR_END[] = "\n</p>";
     281             : static const char HTML_REL_END[] = "\n</div>";
     282             : 
     283             : /* IO_FILE_FORMAT_TXT */
     284             : 
     285             : static const int TXT_ID_INDENT_COLUMN = 48;
     286             : static const char TXT_NEWLINE[] = "\n";
     287             : static const char TXT_SINGLE_INDENT[] = "| ";
     288             : static const char TXT_DOUBLE_INDENT[] = "  | ";
     289             : static const char TXT_SPACE_INDENT[] = "  ";
     290             : static const char TXT_COLON_SPACE[] = ": ";
     291             : static const char TXT_SPACE[] = " ";
     292             : 
     293             : #define io_element_writer_impl_t document_element_writer_t
     294             : /*!
     295             :  *  \brief A struct of function pointers which is the interface of an io_element_writer
     296             :  *
     297             :  *  To avoid typecasts, this struct provides function pointers with the exact right signatures
     298             :  *  provided via io_element_writer_impl_t
     299             :  */
     300             : struct document_element_writer_io_element_writer_if_struct {
     301             : #include "io_element_writer_if.inl"
     302             : };
     303             : #undef io_element_writer_impl_t
     304             : 
     305             : /* the vmt implementing the interface */
     306             : static const struct document_element_writer_io_element_writer_if_struct document_element_writer_private_io_element_writer_if
     307             :     = {
     308             :         .write_header = &document_element_writer_write_header,
     309             :         .start_main = &document_element_writer_start_main,
     310             :         .can_classifier_nest_classifier = &document_element_writer_can_classifier_nest_classifier,
     311             :         .can_classifier_nest_relationship = &document_element_writer_can_classifier_nest_relationship,
     312             :         .start_classifier = &document_element_writer_start_classifier,
     313             :         .assemble_classifier = &document_element_writer_assemble_classifier,
     314             :         .end_classifier = &document_element_writer_end_classifier,
     315             :         .start_feature = &document_element_writer_start_feature,
     316             :         .assemble_feature = &document_element_writer_assemble_feature,
     317             :         .end_feature = &document_element_writer_end_feature,
     318             :         .start_relationship = &document_element_writer_start_relationship,
     319             :         .assemble_relationship = &document_element_writer_assemble_relationship,
     320             :         .end_relationship = &document_element_writer_end_relationship,
     321             :         .start_diagram = &document_element_writer_start_diagram,
     322             :         .assemble_diagram = &document_element_writer_assemble_diagram,
     323             :         .end_diagram = &document_element_writer_end_diagram,
     324             :         .start_diagramelement = &document_element_writer_start_diagramelement,
     325             :         .assemble_diagramelement = &document_element_writer_assemble_diagramelement,
     326             :         .end_diagramelement = &document_element_writer_end_diagramelement,
     327             :         .end_main = &document_element_writer_end_main,
     328             :         .write_footer = &document_element_writer_write_footer
     329             :     };
     330             : 
     331           0 : void document_element_writer_init ( document_element_writer_t *this_,
     332             :                                     data_database_reader_t *db_reader,
     333             :                                     io_file_format_t export_type,
     334             :                                     data_stat_t *io_export_stat,
     335             :                                     universal_output_stream_t *output )
     336             : {
     337           0 :     U8_TRACE_BEGIN();
     338           0 :     assert( NULL != output );
     339           0 :     assert( NULL != io_export_stat );
     340           0 :     assert( NULL != db_reader );
     341             : 
     342           0 :     io_element_writer_private_init( &((*this_).element_writer),
     343             :                                     (io_element_writer_if_t*) &document_element_writer_private_io_element_writer_if,
     344             :                                     this_
     345             :                                   );
     346           0 :     (*this_).export_stat = io_export_stat;
     347             : 
     348           0 :     (*this_).export_type = export_type;
     349           0 :     (*this_).current_tree_depth = 0;
     350             : 
     351           0 :     json_type_name_map_init( &((*this_).type_map) );
     352           0 :     data_rules_init( &((*this_).data_rules) );
     353           0 :     document_link_provider_init( &((*this_).link_provider), db_reader );
     354           0 :     io_txt_icon_init( &((*this_).txt_icon) );
     355             : 
     356           0 :     io_txt_writer_init( &((*this_).txt_writer), output );
     357           0 :     io_xml_writer_init( &((*this_).xml_writer), output );
     358             : 
     359           0 :     switch ( (*this_).export_type )
     360             :     {
     361           0 :         case IO_FILE_FORMAT_DOCBOOK:
     362             :         {
     363           0 :             io_md_writer_init( &((*this_).md_writer),
     364             :                             db_reader,
     365             :                             DOCBOOK_DESCRIPTION_MIDDLE,
     366             :                             DOCBOOK_DESCRIPTION_XREF_START,
     367             :                             DOCBOOK_DESCRIPTION_XREF_MIDDLE,
     368             :                             DOCBOOK_DESCRIPTION_XREF_END,
     369             :                             &((*this_).xml_writer)
     370             :                           );
     371             :         }
     372           0 :         break;
     373             : 
     374           0 :         case IO_FILE_FORMAT_HTML:
     375             :         {
     376           0 :             io_md_writer_init( &((*this_).md_writer),
     377             :                             db_reader,
     378             :                             HTML_ANY_DESCR_NEWLINE,
     379             :                             HTML_ANY_DESCR_XREF_START,
     380             :                             HTML_ANY_DESCR_XREF_MIDDLE,
     381             :                             HTML_ANY_DESCR_XREF_END,
     382             :                             &((*this_).xml_writer)
     383             :                           );
     384             :         }
     385           0 :         break;
     386             : 
     387           0 :         case IO_FILE_FORMAT_TXT:
     388             :         {
     389           0 :             io_md_writer_init( &((*this_).md_writer), db_reader, "\n", "", ": ", "", &((*this_).xml_writer) );
     390             :         }
     391           0 :         break;
     392             : 
     393           0 :         default:
     394             :         {
     395           0 :             U8_LOG_ERROR("error: unknown_format.");
     396           0 :             assert(false);  /* use another io_element_writer instead */
     397             :             io_md_writer_init( &((*this_).md_writer), db_reader, "\n", "", ": ", "", &((*this_).xml_writer) );
     398             :         }
     399             :         break;
     400             :     }
     401             : 
     402           0 :     U8_TRACE_END();
     403           0 : }
     404             : 
     405           0 : void document_element_writer_destroy( document_element_writer_t *this_ )
     406             : {
     407           0 :     U8_TRACE_BEGIN();
     408             : 
     409           0 :     io_md_writer_destroy( &((*this_).md_writer) );
     410           0 :     io_xml_writer_destroy( &((*this_).xml_writer) );
     411           0 :     io_txt_writer_destroy( &((*this_).txt_writer) );
     412             : 
     413           0 :     io_txt_icon_destroy( &((*this_).txt_icon) );
     414           0 :     document_link_provider_destroy( &((*this_).link_provider) );
     415           0 :     data_rules_destroy( &((*this_).data_rules) );
     416           0 :     json_type_name_map_destroy( &((*this_).type_map) );
     417             : 
     418           0 :     (*this_).export_stat = NULL;
     419             : 
     420           0 :     io_element_writer_private_destroy( &((*this_).element_writer) );
     421             : 
     422           0 :     U8_TRACE_END();
     423           0 : }
     424             : 
     425           0 : io_element_writer_t * document_element_writer_get_element_writer( document_element_writer_t *this_ )
     426             : {
     427           0 :     U8_TRACE_BEGIN();
     428             : 
     429           0 :     io_element_writer_t * base = &((*this_).element_writer);
     430             : 
     431           0 :     U8_TRACE_END();
     432           0 :     return base;
     433             : }
     434             : 
     435           0 : u8_error_t document_element_writer_write_header( document_element_writer_t *this_, const char *document_title )
     436             : {
     437           0 :     U8_TRACE_BEGIN();
     438           0 :     assert ( NULL != document_title );
     439           0 :     u8_error_t export_err = U8_ERROR_NONE;
     440             : 
     441           0 :     io_xml_writer_reset_indent ( &((*this_).xml_writer) );
     442             : 
     443           0 :     switch ( (*this_).export_type )
     444             :     {
     445           0 :         case IO_FILE_FORMAT_DOCBOOK:
     446             :         {
     447           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ENC );
     448           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_START );
     449           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     450           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_TITLE_START );
     451           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), document_title );
     452           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_TITLE_END );
     453             :         }
     454           0 :         break;
     455             : 
     456           0 :         case IO_FILE_FORMAT_HTML:
     457             :         {
     458           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DTD );
     459           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DOC_START );
     460           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_START );
     461           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     462           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_TITLE_START );
     463           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), document_title );
     464           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_TITLE_END );
     465           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_CSS_START );
     466           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), document_title );
     467           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_CSS_END );
     468           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     469           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEAD_END );
     470           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_BODY_START );
     471           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     472           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_HEADER );
     473             :         }
     474           0 :         break;
     475             : 
     476           0 :         case IO_FILE_FORMAT_TXT:
     477             :         {
     478             :             /* no header */
     479             :         }
     480           0 :         break;
     481             : 
     482           0 :         default:
     483             :         {
     484           0 :             U8_LOG_ERROR("error: unknown_format.");
     485           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     486             :         }
     487           0 :         break;
     488             :     }
     489             : 
     490           0 :     U8_TRACE_END_ERR( export_err );
     491           0 :     return export_err;
     492             : }
     493             : 
     494           0 : u8_error_t document_element_writer_start_main( document_element_writer_t *this_, const char *document_title )
     495             : {
     496           0 :     U8_TRACE_BEGIN();
     497           0 :     assert( document_title != NULL );
     498           0 :     u8_error_t export_err = U8_ERROR_NONE;
     499             : 
     500           0 :     switch ( (*this_).export_type )
     501             :     {
     502           0 :         case IO_FILE_FORMAT_DOCBOOK:
     503             :         {
     504             :             /* no main start */
     505             :         }
     506           0 :         break;
     507             : 
     508           0 :         case IO_FILE_FORMAT_HTML:
     509             :         {
     510           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_ARTICLE_START );
     511           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     512             :         }
     513           0 :         break;
     514             : 
     515           0 :         case IO_FILE_FORMAT_TXT:
     516             :         {
     517             :             /* no main start */
     518             :         }
     519           0 :         break;
     520             : 
     521           0 :         default:
     522             :         {
     523           0 :             U8_LOG_ERROR("error: unknown_format.");
     524           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     525             :         }
     526           0 :         break;
     527             :     }
     528             : 
     529           0 :     U8_TRACE_END_ERR(export_err);
     530           0 :     return export_err;
     531             : }
     532             : 
     533           0 : bool document_element_writer_can_classifier_nest_classifier( document_element_writer_t *this_,
     534             :                                                              data_classifier_type_t host_type,
     535             :                                                              data_classifier_type_t child_type )
     536             : {
     537           0 :     U8_TRACE_BEGIN();
     538           0 :     const bool can_nest = false;
     539           0 :     U8_TRACE_END();
     540           0 :     return can_nest;
     541             : }
     542             : 
     543           0 : bool document_element_writer_can_classifier_nest_relationship( document_element_writer_t *this_,
     544             :                                                                data_classifier_type_t host_type,
     545             :                                                                data_relationship_type_t child_type )
     546             : {
     547           0 :     U8_TRACE_BEGIN();
     548           0 :     const bool can_nest = true;
     549           0 :     U8_TRACE_END();
     550           0 :     return can_nest;
     551             : }
     552             : 
     553           0 : u8_error_t document_element_writer_start_toc ( document_element_writer_t *this_ )
     554             : {
     555           0 :     U8_TRACE_BEGIN();
     556           0 :     u8_error_t export_err = U8_ERROR_NONE;
     557             : 
     558           0 :     switch ( (*this_).export_type )
     559             :     {
     560           0 :         case IO_FILE_FORMAT_HTML:
     561             :         {
     562           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_NAV_START );
     563           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     564             :         }
     565           0 :         break;
     566             : 
     567           0 :         default:
     568             :         {
     569             :             /* nothing to do, only html provides a table of contents */
     570             :         }
     571           0 :         break;
     572             :     }
     573             : 
     574           0 :     U8_TRACE_END_ERR( export_err );
     575           0 :     return export_err;
     576             : }
     577             : 
     578           0 : u8_error_t document_element_writer_start_toc_sublist ( document_element_writer_t *this_ )
     579             : {
     580           0 :     U8_TRACE_BEGIN();
     581           0 :     u8_error_t export_err = U8_ERROR_NONE;
     582             : 
     583             :     /* increase tree depth */
     584           0 :     (*this_).current_tree_depth ++;
     585             : 
     586           0 :     switch ( (*this_).export_type )
     587             :     {
     588           0 :         case IO_FILE_FORMAT_HTML:
     589             :         {
     590           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_START );
     591           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     592             :         }
     593           0 :         break;
     594             : 
     595           0 :         default:
     596             :         {
     597             :             /* nothing to do, only html provides a table of contents */
     598             :         }
     599           0 :         break;
     600             :     }
     601             : 
     602           0 :     U8_TRACE_END_ERR( export_err );
     603           0 :     return export_err;
     604             : }
     605             : 
     606           0 : u8_error_t document_element_writer_start_toc_entry ( document_element_writer_t *this_ )
     607             : {
     608           0 :     U8_TRACE_BEGIN();
     609           0 :     u8_error_t export_err = U8_ERROR_NONE;
     610             : 
     611           0 :     switch ( (*this_).export_type )
     612             :     {
     613           0 :         case IO_FILE_FORMAT_HTML:
     614             :         {
     615           0 :             const unsigned int index_of_depth = ((*this_).current_tree_depth > HTML_DIAGRAM_MAX_DEPTH)
     616             :                 ? (HTML_DIAGRAM_MAX_DEPTH-1)
     617           0 :                 : ((*this_).current_tree_depth-1);
     618           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_START[index_of_depth] );
     619           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     620             :         }
     621           0 :         break;
     622             : 
     623           0 :         default:
     624             :         {
     625             :             /* nothing to do, only html provides a table of contents */
     626             :         }
     627           0 :         break;
     628             :     }
     629             : 
     630           0 :     U8_TRACE_END_ERR( export_err );
     631           0 :     return export_err;
     632             : }
     633             : 
     634           0 : u8_error_t document_element_writer_write_toc_entry ( document_element_writer_t *this_, const data_diagram_t *diag_ptr )
     635             : {
     636           0 :     U8_TRACE_BEGIN();
     637           0 :     assert ( NULL != diag_ptr );
     638           0 :     u8_error_t export_err = U8_ERROR_NONE;
     639             : 
     640           0 :     switch ( (*this_).export_type )
     641             :     {
     642           0 :         case IO_FILE_FORMAT_HTML:
     643             :         {
     644           0 :             const char *const diag_name = data_diagram_get_name_const(diag_ptr);
     645           0 :             const data_id_t diag_id = data_diagram_get_data_id(diag_ptr);
     646             : 
     647           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_TITLE_START );
     648           0 :             export_err |= io_xml_writer_write_plain_id ( &((*this_).xml_writer), diag_id );
     649           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_TITLE_MIDDLE );
     650           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
     651           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_TITLE_END );
     652             :         }
     653           0 :         break;
     654             : 
     655             : 
     656           0 :         default:
     657             :         {
     658             :             /* nothing to do, only html provides a table of contents */
     659             :         }
     660           0 :         break;
     661             :     }
     662             : 
     663           0 :     U8_TRACE_END_ERR( export_err );
     664           0 :     return export_err;
     665             : }
     666             : 
     667           0 : u8_error_t document_element_writer_end_toc_entry ( document_element_writer_t *this_ )
     668             : {
     669           0 :     U8_TRACE_BEGIN();
     670           0 :     u8_error_t export_err = U8_ERROR_NONE;
     671             : 
     672           0 :     switch ( (*this_).export_type )
     673             :     {
     674           0 :         case IO_FILE_FORMAT_HTML:
     675             :         {
     676           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     677           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_ENTRY_END );
     678             :         }
     679           0 :         break;
     680             : 
     681           0 :         default:
     682             :         {
     683             :             /* nothing to do, only html provides a table of contents */
     684             :         }
     685           0 :         break;
     686             :     }
     687             : 
     688           0 :     U8_TRACE_END_ERR( export_err );
     689           0 :     return export_err;
     690             : }
     691             : 
     692           0 : u8_error_t document_element_writer_end_toc_sublist ( document_element_writer_t *this_ )
     693             : {
     694           0 :     U8_TRACE_BEGIN();
     695           0 :     u8_error_t export_err = U8_ERROR_NONE;
     696             : 
     697           0 :     switch ( (*this_).export_type )
     698             :     {
     699           0 :         case IO_FILE_FORMAT_HTML:
     700             :         {
     701           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     702           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_TOC_SUBLIST_END );
     703             :         }
     704           0 :         break;
     705             : 
     706           0 :         default:
     707             :         {
     708             :             /* nothing to do, only html provides a table of contents */
     709             :         }
     710           0 :         break;
     711             :     }
     712             : 
     713             :     /* decrease tree depth */
     714           0 :     (*this_).current_tree_depth --;
     715             : 
     716           0 :     U8_TRACE_END_ERR( export_err );
     717           0 :     return export_err;
     718             : }
     719             : 
     720           0 : u8_error_t document_element_writer_end_toc ( document_element_writer_t *this_ )
     721             : {
     722           0 :     U8_TRACE_BEGIN();
     723           0 :     u8_error_t export_err = U8_ERROR_NONE;
     724             : 
     725           0 :     switch ( (*this_).export_type )
     726             :     {
     727           0 :         case IO_FILE_FORMAT_HTML:
     728             :         {
     729           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     730           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_NAV_END );
     731             :         }
     732           0 :         break;
     733             : 
     734           0 :         default:
     735             :         {
     736             :             /* nothing to do, only html provides a table of contents */
     737             :         }
     738           0 :         break;
     739             :     }
     740             : 
     741           0 :     U8_TRACE_END_ERR( export_err );
     742           0 :     return export_err;
     743             : }
     744             : 
     745           0 : u8_error_t document_element_writer_start_classifier( document_element_writer_t *this_,
     746             :                                                      data_classifier_type_t host_type,
     747             :                                                      const data_classifier_t *classifier_ptr )
     748             : {
     749           0 :     U8_TRACE_BEGIN();
     750           0 :     assert ( NULL != classifier_ptr );
     751           0 :     u8_error_t export_err = U8_ERROR_NONE;
     752             : 
     753           0 :     switch ( (*this_).export_type )
     754             :     {
     755           0 :         case IO_FILE_FORMAT_DOCBOOK:
     756             :         {
     757           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
     758           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_START );
     759           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     760             :         }
     761           0 :         break;
     762             : 
     763           0 :         case IO_FILE_FORMAT_HTML:
     764             :         {
     765           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_START );
     766           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     767             :         }
     768           0 :         break;
     769             : 
     770           0 :         case IO_FILE_FORMAT_TXT:
     771             :         {
     772           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     773             :         }
     774           0 :         break;
     775             : 
     776           0 :         default:
     777             :         {
     778           0 :             U8_LOG_ERROR("error: unknown_format.");
     779           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     780             :         }
     781           0 :         break;
     782             :     }
     783             : 
     784           0 :     U8_TRACE_END_ERR( export_err );
     785           0 :     return export_err;
     786             : }
     787             : 
     788           0 : u8_error_t document_element_writer_assemble_classifier( document_element_writer_t *this_,
     789             :                                                         data_classifier_type_t host_type,
     790             :                                                         const data_classifier_t *classifier_ptr )
     791             : {
     792           0 :     U8_TRACE_BEGIN();
     793           0 :     assert ( NULL != classifier_ptr );
     794           0 :     u8_error_t export_err = U8_ERROR_NONE;
     795             : 
     796           0 :     const char *const classifier_name = data_classifier_get_name_const(classifier_ptr);
     797           0 :     const char *const classifier_descr = data_classifier_get_description_const(classifier_ptr);
     798           0 :     const size_t classifier_descr_len = utf8string_get_length(classifier_descr);
     799           0 :     const data_id_t classifier_id = data_classifier_get_data_id(classifier_ptr);
     800             :     const char *const classifier_type_name
     801           0 :         = json_type_name_map_get_classifier_type( &((*this_).type_map),
     802             :                                                   host_type,
     803             :                                                   data_classifier_get_main_type( classifier_ptr )
     804             :                                                 );
     805           0 :     const char *const classifier_stereotype = data_classifier_get_stereotype_const( classifier_ptr );
     806             :     data_diagram_t (*appears_in_diagrams)[];
     807             :     uint32_t appears_in_diagrams_count;
     808             :     const u8_error_t appears_in_diagrams_err
     809           0 :         = document_link_provider_get_occurrences( &((*this_).link_provider),
     810             :                                                   classifier_id,
     811             :                                                   &appears_in_diagrams,
     812             :                                                   &appears_in_diagrams_count
     813             :                                                 );
     814             : 
     815           0 :     switch ( (*this_).export_type )
     816             :     {
     817           0 :         case IO_FILE_FORMAT_DOCBOOK:
     818             :         {
     819           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
     820           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     821             : 
     822           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
     823           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_name );
     824           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
     825             : 
     826           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
     827           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
     828           0 :             if ( 0 != utf8string_get_length( classifier_stereotype ) )
     829             :             {
     830           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
     831           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_stereotype );
     832           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
     833             :             }
     834           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
     835           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), classifier_id );
     836           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
     837             : 
     838           0 :             if (( U8_ERROR_NONE == appears_in_diagrams_err )
     839           0 :                ||( U8_ERROR_ARRAY_BUFFER_EXCEEDED == appears_in_diagrams_err ))
     840             :             {
     841           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_SEE_START );
     842           0 :                 bool is_first = true;
     843           0 :                 for ( uint_fast32_t idx = 0; idx < appears_in_diagrams_count; idx ++ )
     844             :                 {
     845           0 :                     const data_diagram_t *const current = &((*appears_in_diagrams)[idx]);
     846           0 :                     const data_id_t diag_ref_id = data_diagram_get_data_id( current );
     847           0 :                     if ( is_first )
     848             :                     {
     849           0 :                         is_first = false;
     850             :                     }
     851             :                     else
     852             :                     {
     853           0 :                         export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_SEE_NEXT );
     854             :                     }
     855           0 :                     const char *const diag_ref_name = data_diagram_get_name_const( current );
     856           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_XREF_START );
     857           0 :                     export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_ref_id );
     858           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_XREF_MIDDLE );
     859           0 :                     export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), diag_ref_name );
     860           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_XREF_END );
     861             :                 }
     862           0 :                 if ( U8_ERROR_ARRAY_BUFFER_EXCEEDED == appears_in_diagrams_err )
     863             :                 {
     864           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_SEE_MORE );
     865             :                 }
     866           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_SEE_END );
     867             :             }
     868             : 
     869           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     870           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
     871             : 
     872           0 :             if ( 0 != classifier_descr_len )
     873             :             {
     874           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_START );
     875           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), classifier_descr );
     876           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_END );
     877             :             }
     878             : 
     879           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     880           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
     881             :         }
     882           0 :         break;
     883             : 
     884           0 :         case IO_FILE_FORMAT_HTML:
     885             :         {
     886           0 :             if (( U8_ERROR_NONE == appears_in_diagrams_err )
     887           0 :                ||( U8_ERROR_ARRAY_BUFFER_EXCEEDED == appears_in_diagrams_err ))
     888             :             {
     889           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_SEE_START );
     890           0 :                 bool is_first = true;
     891           0 :                 for ( uint_fast32_t idx = 0; idx < appears_in_diagrams_count; idx ++ )
     892             :                 {
     893           0 :                     const data_diagram_t *const current = &((*appears_in_diagrams)[idx]);
     894           0 :                     const data_id_t diag_ref_id = data_diagram_get_data_id( current );
     895           0 :                     if ( is_first )
     896             :                     {
     897           0 :                         is_first = false;
     898             :                     }
     899             :                     else
     900             :                     {
     901           0 :                         export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_SEE_NEXT );
     902             :                     }
     903           0 :                     const char *const diag_ref_name = data_diagram_get_name_const( current );
     904           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_ANY_DESCR_XREF_START );
     905           0 :                     export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_ref_id );
     906           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_ANY_DESCR_XREF_MIDDLE );
     907           0 :                     export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), diag_ref_name );
     908           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_ANY_DESCR_XREF_END );
     909             :                 }
     910           0 :                 if ( U8_ERROR_ARRAY_BUFFER_EXCEEDED == appears_in_diagrams_err )
     911             :                 {
     912           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_SEE_MORE );
     913             :                 }
     914           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_SEE_END );
     915             :             }
     916             : 
     917           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_HEAD_START );
     918           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_NAME_START );
     919           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_name );
     920           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_NAME_END );
     921           0 :             if ( 0 != utf8string_get_length( classifier_stereotype ) )
     922             :             {
     923           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_STEREO_START );
     924           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), classifier_stereotype );
     925           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_STEREO_END );
     926             :             }
     927           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_TYPE_START );
     928           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), classifier_type_name );
     929           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_TYPE_END );
     930           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_ID_START );
     931           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), classifier_id );
     932           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_ID_END );
     933           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_HEAD_END );
     934             : 
     935           0 :             if ( 0 != classifier_descr_len )
     936             :             {
     937           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_DESCR_START );
     938           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), classifier_descr );
     939           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_DESCR_END );
     940             :             }
     941             :         }
     942           0 :         break;
     943             : 
     944           0 :         case IO_FILE_FORMAT_TXT:
     945             :         {
     946           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     947           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), classifier_name );
     948           0 :             const utf8stringview_t classifier_name_view = UTF8STRINGVIEW_STR( classifier_name );
     949           0 :             const size_t clas_codepoint = utf8stringview_count_codepoints( &classifier_name_view );
     950           0 :             export_err |= io_txt_writer_write_indent_id( &((*this_).txt_writer),
     951           0 :                                                          TXT_ID_INDENT_COLUMN - clas_codepoint,
     952             :                                                          classifier_id
     953             :                                                        );
     954           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
     955           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
     956             :                                                                        TXT_SINGLE_INDENT,
     957             :                                                                        classifier_descr
     958             :                                                                      );
     959             :         }
     960           0 :         break;
     961             : 
     962           0 :         default:
     963             :         {
     964           0 :             U8_LOG_ERROR("error: unknown_format.");
     965           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
     966             :         }
     967           0 :         break;
     968             :     }
     969             : 
     970             :     /* update export statistics */
     971           0 :     data_stat_inc_count ( (*this_).export_stat, DATA_STAT_TABLE_CLASSIFIER, DATA_STAT_SERIES_EXPORTED );
     972             : 
     973           0 :     U8_TRACE_END_ERR( export_err );
     974           0 :     return export_err;
     975             : }
     976             : 
     977           0 : u8_error_t document_element_writer_end_classifier( document_element_writer_t *this_,
     978             :                                                    data_classifier_type_t host_type,
     979             :                                                    const data_classifier_t *classifier_ptr )
     980             : {
     981           0 :     U8_TRACE_BEGIN();
     982           0 :     assert ( NULL != classifier_ptr );
     983           0 :     u8_error_t export_err = U8_ERROR_NONE;
     984             : 
     985           0 :     switch ( (*this_).export_type )
     986             :     {
     987           0 :         case IO_FILE_FORMAT_DOCBOOK:
     988             :         {
     989           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     990           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_END );
     991           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
     992             :         }
     993           0 :         break;
     994             : 
     995           0 :         case IO_FILE_FORMAT_HTML:
     996             :         {
     997           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
     998           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_CLAS_END );
     999             :         }
    1000           0 :         break;
    1001             : 
    1002           0 :         case IO_FILE_FORMAT_TXT:
    1003             :         {
    1004             :             /* no end classifier tags */
    1005             :         }
    1006           0 :         break;
    1007             : 
    1008           0 :         default:
    1009             :         {
    1010           0 :             U8_LOG_ERROR("error: unknown_format.");
    1011           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1012             :         }
    1013           0 :         break;
    1014             :     }
    1015             : 
    1016           0 :     U8_TRACE_END_ERR( export_err );
    1017           0 :     return export_err;
    1018             : }
    1019             : 
    1020           0 : u8_error_t document_element_writer_start_feature( document_element_writer_t *this_,
    1021             :                                                   data_classifier_type_t parent_type,
    1022             :                                                   const data_feature_t *feature_ptr)
    1023             : {
    1024           0 :     U8_TRACE_BEGIN();
    1025           0 :     assert( feature_ptr != NULL );
    1026           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1027             : 
    1028           0 :     switch ( (*this_).export_type )
    1029             :     {
    1030           0 :         case IO_FILE_FORMAT_HTML:
    1031             :         {
    1032           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_START );
    1033           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1034             :         }
    1035           0 :         break;
    1036             : 
    1037           0 :         default:
    1038             :         {
    1039             :         }
    1040           0 :         break;
    1041             :     }
    1042             : 
    1043           0 :     U8_TRACE_END_ERR(export_err);
    1044           0 :     return export_err;
    1045             : }
    1046             : 
    1047           0 : u8_error_t document_element_writer_assemble_feature( document_element_writer_t *this_,
    1048             :                                                      const data_classifier_t *parent,
    1049             :                                                      const data_feature_t *feature_ptr )
    1050             : {
    1051           0 :     U8_TRACE_BEGIN();
    1052           0 :     assert ( NULL != feature_ptr );
    1053           0 :     assert( parent != NULL );
    1054           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1055             : 
    1056           0 :     const char *const feature_key = data_feature_get_key_const( feature_ptr );
    1057           0 :     const char *const feature_value = data_feature_get_value_const( feature_ptr );
    1058           0 :     const size_t feature_value_len = utf8string_get_length(feature_value);
    1059           0 :     const char *const feature_descr = data_feature_get_description_const( feature_ptr );
    1060           0 :     const size_t feature_descr_len = utf8string_get_length(feature_descr);
    1061           0 :     const data_id_t feature_id = data_feature_get_data_id( feature_ptr );
    1062           0 :     const data_classifier_type_t parent_type = data_classifier_get_main_type( parent );
    1063           0 :     const data_feature_type_t feature_type = data_feature_get_main_type( feature_ptr );
    1064             :     const char *const feature_type_name
    1065           0 :         = json_type_name_map_get_feature_type( &((*this_).type_map),
    1066             :                                                parent_type,
    1067             :                                                feature_type
    1068             :                                              );
    1069           0 :     const bool has_stereotype = data_rules_feature_value_is_stereotype( &((*this_).data_rules), feature_type );
    1070             : 
    1071           0 :     switch ( (*this_).export_type )
    1072             :     {
    1073           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1074             :         {
    1075           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
    1076           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1077             : 
    1078           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
    1079           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_key );
    1080           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
    1081             : 
    1082           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
    1083           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1084           0 :             if ( 0 != feature_value_len )
    1085             :             {
    1086           0 :                 if ( has_stereotype )
    1087             :                 {
    1088           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
    1089           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1090           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
    1091             :                 }
    1092             :                 else
    1093             :                 {
    1094           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_COLON_SPACE );
    1095           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1096             :                 }
    1097             :             }
    1098           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
    1099           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), feature_id );
    1100           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
    1101           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1102           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
    1103             : 
    1104           0 :             if ( 0 != feature_descr_len )
    1105             :             {
    1106           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_START );
    1107           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), feature_descr );
    1108           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_END );
    1109             :             }
    1110             : 
    1111           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1112           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
    1113             :         }
    1114           0 :         break;
    1115             : 
    1116           0 :         case IO_FILE_FORMAT_HTML:
    1117             :         {
    1118           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_HEAD_START );
    1119           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_NAME_START );
    1120           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_key );
    1121           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_NAME_END );
    1122           0 :             if ( 0 != feature_value_len )
    1123             :             {
    1124           0 :                 if ( has_stereotype )
    1125             :                 {
    1126           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_STEREO_START );
    1127           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1128           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_STEREO_END );
    1129             :                 }
    1130             :                 else
    1131             :                 {
    1132           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_COLON_SPACE );
    1133           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_VALUE_START );
    1134           0 :                     export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), feature_value );
    1135           0 :                     export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_VALUE_END );
    1136             :                 }
    1137             :             }
    1138           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_TYPE_START );
    1139           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), feature_type_name );
    1140           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_TYPE_END );
    1141           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_ID_START );
    1142           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), feature_id );
    1143           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_ID_END );
    1144           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_HEAD_END );
    1145           0 :             if ( 0 != feature_descr_len )
    1146             :             {
    1147           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_DESCR_START );
    1148           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), feature_descr );
    1149           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_DESCR_END );
    1150             :             }
    1151             :         }
    1152           0 :         break;
    1153             : 
    1154           0 :         case IO_FILE_FORMAT_TXT:
    1155             :         {
    1156           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_SPACE_INDENT );
    1157           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), feature_key );
    1158           0 :             if ( 0 != feature_value_len )
    1159             :             {
    1160           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_COLON_SPACE );
    1161           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), feature_value );
    1162             :             }
    1163             : 
    1164           0 :             const utf8stringview_t feature_key_view = UTF8STRINGVIEW_STR( feature_key );
    1165           0 :             const utf8stringview_t feature_value_view = UTF8STRINGVIEW_STR( feature_value );
    1166           0 :             const size_t feat_key_codepoint = utf8stringview_count_codepoints( &feature_key_view );
    1167           0 :             const size_t feat_value_codepoint = utf8stringview_count_codepoints( &feature_value_view );
    1168           0 :             int id_indent_width = TXT_ID_INDENT_COLUMN - utf8string_get_length(TXT_SPACE_INDENT) - feat_key_codepoint
    1169           0 :                 - ((feature_value_len==0)?0:(feat_value_codepoint+utf8string_get_length(TXT_COLON_SPACE)));
    1170           0 :             export_err |= io_txt_writer_write_indent_id( &((*this_).txt_writer),
    1171             :                                                          id_indent_width,
    1172             :                                                          feature_id
    1173             :                                                        );
    1174           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
    1175           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
    1176             :                                                                        TXT_DOUBLE_INDENT,
    1177             :                                                                        feature_descr
    1178             :                                                                      );
    1179             :         }
    1180           0 :         break;
    1181             : 
    1182           0 :         default:
    1183             :         {
    1184           0 :             U8_LOG_ERROR("error: unknown_format.");
    1185           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1186             :         }
    1187           0 :         break;
    1188             :     }
    1189             : 
    1190             :     /* update export statistics */
    1191           0 :     const data_feature_type_t feat_type = data_feature_get_main_type( feature_ptr );
    1192           0 :     const data_stat_table_t feat_or_lifeline
    1193           0 :         = ( feat_type == DATA_FEATURE_TYPE_LIFELINE ) ? DATA_STAT_TABLE_LIFELINE : DATA_STAT_TABLE_FEATURE;
    1194           0 :     data_stat_inc_count ( (*this_).export_stat, feat_or_lifeline, DATA_STAT_SERIES_EXPORTED );
    1195             : 
    1196           0 :     U8_TRACE_END_ERR( export_err );
    1197           0 :     return export_err;
    1198             : }
    1199             : 
    1200           0 : u8_error_t document_element_writer_end_feature( document_element_writer_t *this_,
    1201             :                                                 data_classifier_type_t parent_type,
    1202             :                                                 const data_feature_t *feature_ptr)
    1203             : {
    1204           0 :     U8_TRACE_BEGIN();
    1205           0 :     assert( feature_ptr != NULL );
    1206           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1207             : 
    1208           0 :     switch ( (*this_).export_type )
    1209             :     {
    1210           0 :         case IO_FILE_FORMAT_HTML:
    1211             :         {
    1212           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1213           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FEAT_END );
    1214             :         }
    1215           0 :         break;
    1216             : 
    1217           0 :         default:
    1218             :         {
    1219             :         }
    1220           0 :         break;
    1221             :     }
    1222             : 
    1223           0 :     U8_TRACE_END_ERR(export_err);
    1224           0 :     return export_err;
    1225             : }
    1226             : 
    1227           0 : u8_error_t document_element_writer_start_relationship( document_element_writer_t *this_,
    1228             :                                                        data_classifier_type_t host_type,
    1229             :                                                        const data_relationship_t *relation_ptr)
    1230             : {
    1231           0 :     U8_TRACE_BEGIN();
    1232           0 :     assert( relation_ptr != NULL );
    1233           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1234             : 
    1235           0 :     switch ( (*this_).export_type )
    1236             :     {
    1237           0 :         case IO_FILE_FORMAT_HTML:
    1238             :         {
    1239           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_START );
    1240           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1241             :         }
    1242           0 :         break;
    1243             : 
    1244           0 :         default:
    1245             :         {
    1246             :         }
    1247           0 :         break;
    1248             :     }
    1249             : 
    1250           0 :     U8_TRACE_END_ERR(export_err);
    1251           0 :     return export_err;
    1252             : }
    1253             : 
    1254           0 : u8_error_t document_element_writer_assemble_relationship( document_element_writer_t *this_,
    1255             :                                                           const data_classifier_t *host,
    1256             :                                                           const data_relationship_t *relation_ptr,
    1257             :                                                           const data_classifier_t *from_c,
    1258             :                                                           const data_feature_t *from_f,
    1259             :                                                           const data_classifier_t *to_c,
    1260             :                                                           const data_feature_t *to_f )
    1261             : {
    1262           0 :     U8_TRACE_BEGIN();
    1263           0 :     assert ( NULL != relation_ptr );
    1264             :     /* NULL is allowed here: dest_classifier_ptr */
    1265           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1266             : 
    1267           0 :     const char *const relation_name = data_relationship_get_name_const( relation_ptr );
    1268           0 :     const data_id_t relation_id = data_relationship_get_data_id( relation_ptr );
    1269           0 :     const char *const relation_descr = data_relationship_get_description_const( relation_ptr );
    1270           0 :     const size_t relation_descr_len = utf8string_get_length(relation_descr);
    1271           0 :     const data_relationship_type_t relation_type = data_relationship_get_main_type( relation_ptr );
    1272           0 :     const char *const dest_classifier_name
    1273             :         = (NULL != to_c)
    1274           0 :         ? data_classifier_get_name_const( to_c )
    1275           0 :         : "";
    1276           0 :     const bool from_c_valid = ( from_c == NULL ) ? false : data_classifier_is_valid( from_c );
    1277           0 :     const bool to_c_valid = ( to_c == NULL ) ? false : data_classifier_is_valid( to_c );
    1278           0 :     const bool statemachine_context
    1279             :         = (from_c_valid
    1280           0 :         && ((data_classifier_get_main_type( from_c ) == DATA_CLASSIFIER_TYPE_STATE)
    1281           0 :         || (data_classifier_get_main_type( from_c ) == DATA_CLASSIFIER_TYPE_DYN_SHALLOW_HISTORY)
    1282           0 :         || (data_classifier_get_main_type( from_c ) == DATA_CLASSIFIER_TYPE_DYN_DEEP_HISTORY)))
    1283           0 :         || (to_c_valid
    1284           0 :         && (( data_classifier_get_main_type( to_c ) == DATA_CLASSIFIER_TYPE_STATE)
    1285           0 :         || (data_classifier_get_main_type( to_c ) == DATA_CLASSIFIER_TYPE_DYN_SHALLOW_HISTORY)
    1286           0 :         || (data_classifier_get_main_type( to_c ) == DATA_CLASSIFIER_TYPE_DYN_DEEP_HISTORY)));
    1287             :     const char *const relation_type_name
    1288           0 :         = json_type_name_map_get_relationship_type( &((*this_).type_map),
    1289             :                                                     statemachine_context,
    1290             :                                                     relation_type
    1291             :                                                   );
    1292           0 :     const char*const relation_txticon = io_txt_icon_get_relationship ( &((*this_).txt_icon), relation_type );
    1293             : 
    1294           0 :     const char *const relation_stereotype = data_relationship_get_stereotype_const( relation_ptr );
    1295             : 
    1296           0 :     switch ( (*this_).export_type )
    1297             :     {
    1298           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1299             :         {
    1300             :             /* list start */
    1301           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
    1302           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_START );
    1303           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1304             :             /* element */
    1305           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
    1306           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1307             : 
    1308           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
    1309           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_name );
    1310           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
    1311             : 
    1312           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
    1313           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1314           0 :             if ( 0 != utf8string_get_length( relation_stereotype ) )
    1315             :             {
    1316           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
    1317           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_stereotype );
    1318           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
    1319             :             }
    1320           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1321           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_txticon );
    1322           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1323           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), dest_classifier_name );
    1324           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
    1325           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), relation_id );
    1326           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
    1327           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1328           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
    1329             : 
    1330           0 :             if ( 0 != relation_descr_len )
    1331             :             {
    1332           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_START );
    1333           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), relation_descr );
    1334           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_DESCR_END );
    1335             :             }
    1336             : 
    1337           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1338           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
    1339             :             /* list end */
    1340           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1341           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_END );
    1342           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
    1343             :         }
    1344           0 :         break;
    1345             : 
    1346           0 :         case IO_FILE_FORMAT_HTML:
    1347             :         {
    1348           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_HEAD_START );
    1349           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_NAME_START );
    1350           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_name );
    1351           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_NAME_END );
    1352           0 :             if ( 0 != utf8string_get_length( relation_stereotype ) )
    1353             :             {
    1354           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_STEREO_START );
    1355           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_stereotype );
    1356           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_STEREO_END );
    1357             :             }
    1358           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1359           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), relation_txticon );
    1360           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), TXT_SPACE );
    1361           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DEST_START );
    1362           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), dest_classifier_name );
    1363           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DEST_END );
    1364           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_TYPE_START );
    1365           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), relation_type_name );
    1366           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_TYPE_END );
    1367           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_ID_START );
    1368           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), relation_id );
    1369           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_ID_END );
    1370           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_HEAD_END );
    1371           0 :             if ( 0 != relation_descr_len )
    1372             :             {
    1373           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DESCR_START );
    1374           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), relation_descr );
    1375           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_DESCR_END );
    1376             :             }
    1377             :         }
    1378           0 :         break;
    1379             : 
    1380           0 :         case IO_FILE_FORMAT_TXT:
    1381             :         {
    1382           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_SPACE_INDENT );
    1383             : 
    1384           0 :             size_t relation_name_len = utf8string_get_length(relation_name);
    1385             :             /* print arrow */
    1386           0 :             if ( relation_name_len != 0 )
    1387             :             {
    1388           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), relation_name );
    1389           0 :                 export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_SPACE );
    1390             :             }
    1391           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), relation_txticon );
    1392           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_SPACE );
    1393             : 
    1394           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), dest_classifier_name );
    1395             : 
    1396             :             /* print id */
    1397           0 :             const utf8stringview_t relation_name_view = UTF8STRINGVIEW_STR( relation_name );
    1398           0 :             const utf8stringview_t relation_txticon_view = UTF8STRINGVIEW_STR( relation_txticon );
    1399           0 :             const utf8stringview_t dest_classifier_name_view = UTF8STRINGVIEW_STR( dest_classifier_name );
    1400           0 :             const size_t rel_name_codepoint = utf8stringview_count_codepoints( &relation_name_view);
    1401           0 :             const size_t rel_icon_codepoint = utf8stringview_count_codepoints( &relation_txticon_view );
    1402           0 :             const size_t rel_dest_codepoint = utf8stringview_count_codepoints( &dest_classifier_name_view );
    1403           0 :             int id_indent_width
    1404             :                 = TXT_ID_INDENT_COLUMN
    1405           0 :                 - utf8string_get_length(TXT_SPACE_INDENT)
    1406           0 :                 - ((relation_name_len==0)?0:(rel_name_codepoint+utf8string_get_length(TXT_SPACE)))
    1407           0 :                 - rel_icon_codepoint
    1408           0 :                 - utf8string_get_length(TXT_SPACE)
    1409           0 :                 - rel_dest_codepoint;
    1410           0 :             export_err |= io_txt_writer_write_indent_id( &((*this_).txt_writer),
    1411             :                                                          id_indent_width,
    1412             :                                                          relation_id
    1413             :                                                        );
    1414             : 
    1415           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
    1416           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
    1417             :                                                                        TXT_DOUBLE_INDENT,
    1418             :                                                                        relation_descr
    1419             :                                                                      );
    1420             :         }
    1421           0 :         break;
    1422             : 
    1423           0 :         default:
    1424             :         {
    1425           0 :             U8_LOG_ERROR("error: unknown_format.");
    1426           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1427             :         }
    1428           0 :         break;
    1429             :     }
    1430             : 
    1431             :     /* update export statistics */
    1432           0 :     data_stat_inc_count ( (*this_).export_stat, DATA_STAT_TABLE_RELATIONSHIP, DATA_STAT_SERIES_EXPORTED );
    1433             : 
    1434           0 :     U8_TRACE_END_ERR( export_err );
    1435           0 :     return export_err;
    1436             : }
    1437             : 
    1438           0 : u8_error_t document_element_writer_end_relationship( document_element_writer_t *this_,
    1439             :                                                      data_classifier_type_t host_type,
    1440             :                                                      const data_relationship_t *relation_ptr)
    1441             : {
    1442           0 :     U8_TRACE_BEGIN();
    1443           0 :     assert( relation_ptr != NULL );
    1444           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1445             : 
    1446           0 :     switch ( (*this_).export_type )
    1447             :     {
    1448           0 :         case IO_FILE_FORMAT_HTML:
    1449             :         {
    1450           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1451           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_REL_END );
    1452             :         }
    1453           0 :         break;
    1454             : 
    1455           0 :         default:
    1456             :         {
    1457             :         }
    1458           0 :         break;
    1459             :     }
    1460             : 
    1461           0 :     U8_TRACE_END_ERR(export_err);
    1462           0 :     return export_err;
    1463             : }
    1464             : 
    1465           0 : u8_error_t document_element_writer_start_diagram( document_element_writer_t *this_, const data_diagram_t *diag_ptr )
    1466             : {
    1467           0 :     U8_TRACE_BEGIN();
    1468           0 :     assert ( NULL != diag_ptr );
    1469           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1470             : 
    1471           0 :     const data_id_t diag_id = data_diagram_get_data_id(diag_ptr);
    1472           0 :     const char *const diag_name = data_diagram_get_name_const( diag_ptr );
    1473             : 
    1474             :     /* increase tree depth */
    1475           0 :     (*this_).current_tree_depth ++;
    1476             : 
    1477           0 :     switch ( (*this_).export_type )
    1478             :     {
    1479           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1480             :         {
    1481           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), ((*this_).current_tree_depth==1) ? DOCBOOK_TOP_DIAGRAM_START : DOCBOOK_DIAGRAM_START );
    1482           0 :             export_err |= io_xml_writer_write_plain_id ( &((*this_).xml_writer), diag_id );
    1483           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), ((*this_).current_tree_depth==1) ? DOCBOOK_TOP_DIAGRAM_MIDDLE : DOCBOOK_DIAGRAM_MIDDLE );
    1484           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1485             :         }
    1486           0 :         break;
    1487             : 
    1488           0 :         case IO_FILE_FORMAT_HTML:
    1489             :         {
    1490           0 :             const unsigned int index_of_depth = ((*this_).current_tree_depth > HTML_DIAGRAM_MAX_DEPTH)
    1491             :                 ? (HTML_DIAGRAM_MAX_DEPTH-1)
    1492           0 :                 : ((*this_).current_tree_depth-1);
    1493           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_TITLE_START[index_of_depth] );
    1494           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_id );
    1495           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_TITLE_MIDDLE );
    1496           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1497           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_TITLE_END[index_of_depth] );
    1498             :         }
    1499           0 :         break;
    1500             : 
    1501           0 :         case IO_FILE_FORMAT_TXT:
    1502             :         {
    1503             :             /* no start diagram tags */
    1504             :         }
    1505           0 :         break;
    1506             : 
    1507           0 :         default:
    1508             :         {
    1509           0 :             U8_LOG_ERROR("error: unknown_format.");
    1510           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1511             :         }
    1512           0 :         break;
    1513             :     }
    1514           0 :     if ( export_err != 0 )
    1515             :     {
    1516           0 :         U8_LOG_ERROR( "not all bytes could be written" );
    1517             :     }
    1518             : 
    1519           0 :     U8_TRACE_END_ERR( export_err );
    1520           0 :     return export_err;
    1521             : }
    1522             : 
    1523           0 : u8_error_t document_element_writer_assemble_diagram( document_element_writer_t *this_,
    1524             :                                                      const data_diagram_t *parent,
    1525             :                                                      const data_diagram_t *diag_ptr,
    1526             :                                                      const char *diagram_file_base_name )
    1527             : {
    1528           0 :     U8_TRACE_BEGIN();
    1529             :     /* parent may be NULL */
    1530           0 :     assert ( NULL != diag_ptr );
    1531           0 :     assert ( NULL != diagram_file_base_name );
    1532           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1533             : 
    1534           0 :     const char *const diag_name = data_diagram_get_name_const( diag_ptr );
    1535           0 :     const char *const diag_description = data_diagram_get_description_const( diag_ptr );
    1536           0 :     const data_id_t diag_id = data_diagram_get_data_id(diag_ptr);
    1537             :     const char *const diag_type_name
    1538           0 :         = json_type_name_map_get_diagram_type( &((*this_).type_map),
    1539             :                                                data_diagram_get_diagram_type( diag_ptr )
    1540             :                                               );
    1541           0 :     const char *const diag_stereotype = data_diagram_get_stereotype_const( diag_ptr );
    1542             : 
    1543           0 :     switch ( (*this_).export_type )
    1544             :     {
    1545           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1546             :         {
    1547           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_TITLE_START );
    1548           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1549           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_TITLE_END );
    1550             : 
    1551           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
    1552           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_START );
    1553           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1554           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_START );
    1555           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1556             : 
    1557           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_START );
    1558           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1559           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_NAME_END );
    1560             : 
    1561           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_START );
    1562           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1563           0 :             if ( 0 != utf8string_get_length( diag_stereotype ) )
    1564             :             {
    1565           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_START );
    1566           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_stereotype );
    1567           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_STEREO_END );
    1568             :             }
    1569           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_START );
    1570           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_id );
    1571           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ID_END );
    1572           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1573           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_ATTRIBUTES_END );
    1574             : 
    1575           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1576           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_END );
    1577           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1578           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_ELEMENT_LIST_END );
    1579           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
    1580             : 
    1581           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_START );
    1582           0 :             export_err |= io_md_writer_transform ( &((*this_).md_writer), diag_description );
    1583           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DESCRIPTION_END );
    1584             : 
    1585           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_IMG_START );
    1586           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diagram_file_base_name );
    1587           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_IMG_MIDDLE );
    1588           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diagram_file_base_name );
    1589           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DIAGRAM_IMG_END );
    1590             :         }
    1591           0 :         break;
    1592             : 
    1593           0 :         case IO_FILE_FORMAT_HTML:
    1594             :         {
    1595             :             /* diagram start */
    1596           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_START );
    1597           0 :             io_xml_writer_increase_indent ( &((*this_).xml_writer) );
    1598             : 
    1599             :             /* diagram contents */
    1600           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_HEAD_START );
    1601           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_NAME_START );
    1602           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_name );
    1603           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_NAME_END );
    1604           0 :             if ( 0 != utf8string_get_length( diag_stereotype ) )
    1605             :             {
    1606           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_STEREO_START );
    1607           0 :                 export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diag_stereotype );
    1608           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_STEREO_END );
    1609             :             }
    1610           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_TYPE_START );
    1611           0 :             export_err |= io_xml_writer_write_xml_enc( &((*this_).xml_writer), diag_type_name );
    1612           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_TYPE_END );
    1613           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_ID_START );
    1614           0 :             export_err |= io_xml_writer_write_plain_id( &((*this_).xml_writer), diag_id );
    1615           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_ID_END );
    1616           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_HEAD_END );
    1617           0 :             if ( 0 != utf8string_get_length( diag_description ) )
    1618             :             {
    1619           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_DESCR_START );
    1620           0 :                 export_err |= io_md_writer_transform ( &((*this_).md_writer), diag_description );
    1621           0 :                 export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_DESCR_END );
    1622             :             }
    1623             : 
    1624             :             /* diagram end happens here to avoid recursion to child diagrams before the end */
    1625           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1626           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAG_END );
    1627             : 
    1628             :             /* show the diagram-picture */
    1629           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_IMG_START );
    1630           0 :             export_err |= io_xml_writer_write_xml_enc ( &((*this_).xml_writer), diagram_file_base_name );
    1631           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DIAGRAM_IMG_END );
    1632             :         }
    1633           0 :         break;
    1634             : 
    1635           0 :         case IO_FILE_FORMAT_TXT:
    1636             :         {
    1637           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), diag_name );
    1638           0 :             const utf8stringview_t diag_name_view = UTF8STRINGVIEW_STR( diag_name );
    1639           0 :             const size_t diag_name_codepoint = utf8stringview_count_codepoints( &diag_name_view );
    1640           0 :             export_err |= io_txt_writer_write_indent_id( &((*this_).txt_writer),
    1641           0 :                                                          TXT_ID_INDENT_COLUMN - diag_name_codepoint,
    1642             :                                                          diag_id
    1643             :                                                        );
    1644           0 :             export_err |= io_txt_writer_write_plain ( &((*this_).txt_writer), TXT_NEWLINE );
    1645           0 :             export_err |= io_txt_writer_write_indent_multiline_string( &((*this_).txt_writer),
    1646             :                                                                        TXT_SINGLE_INDENT,
    1647             :                                                                        diag_description
    1648             :                                                                      );
    1649             :         }
    1650           0 :         break;
    1651             : 
    1652           0 :         default:
    1653             :         {
    1654           0 :             U8_LOG_ERROR("error: unknown_format.");
    1655           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1656             :         }
    1657           0 :         break;
    1658             :     }
    1659             : 
    1660             :     /* update export statistics */
    1661           0 :     data_stat_inc_count ( (*this_).export_stat, DATA_STAT_TABLE_DIAGRAM, DATA_STAT_SERIES_EXPORTED );
    1662             : 
    1663           0 :     U8_TRACE_END_ERR( export_err );
    1664           0 :     return export_err;
    1665             : }
    1666             : 
    1667           0 : u8_error_t document_element_writer_end_diagram( document_element_writer_t *this_, const data_diagram_t *diag_ptr )
    1668             : {
    1669           0 :     U8_TRACE_BEGIN();
    1670           0 :     assert ( NULL != diag_ptr );
    1671           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1672             : 
    1673           0 :     switch ( (*this_).export_type )
    1674             :     {
    1675           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1676             :         {
    1677           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1678           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), ((*this_).current_tree_depth==1) ? DOCBOOK_TOP_DIAGRAM_END : DOCBOOK_DIAGRAM_END );
    1679             :         }
    1680           0 :         break;
    1681             : 
    1682           0 :         case IO_FILE_FORMAT_HTML:
    1683             :         {
    1684             :         }
    1685           0 :         break;
    1686             : 
    1687           0 :         case IO_FILE_FORMAT_TXT:
    1688             :         {
    1689             :             /* no end diagram tags */
    1690             :         }
    1691           0 :         break;
    1692             : 
    1693           0 :         default:
    1694             :         {
    1695           0 :             U8_LOG_ERROR("error: unknown_format.");
    1696           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1697             :         }
    1698           0 :         break;
    1699             :     }
    1700             : 
    1701             :     /* decrease tree depth */
    1702           0 :     (*this_).current_tree_depth --;
    1703             : 
    1704           0 :     U8_TRACE_END_ERR( export_err );
    1705           0 :     return export_err;
    1706             : }
    1707             : 
    1708           0 : u8_error_t document_element_writer_start_diagramelement( document_element_writer_t *this_,
    1709             :                                                          const data_diagram_t *parent,
    1710             :                                                          const data_diagramelement_t *diagramelement_ptr )
    1711             : {
    1712           0 :     U8_TRACE_BEGIN();
    1713           0 :     assert( diagramelement_ptr != NULL );
    1714           0 :     assert( parent != NULL );
    1715           0 :     u8_error_t write_error = U8_ERROR_NONE;
    1716             : 
    1717           0 :     U8_TRACE_END_ERR(write_error);
    1718           0 :     return write_error;
    1719             : }
    1720             : 
    1721           0 : u8_error_t document_element_writer_assemble_diagramelement( document_element_writer_t *this_,
    1722             :                                                             const data_diagram_t *parent,
    1723             :                                                             const data_diagramelement_t *diagramelement_ptr,
    1724             :                                                             const data_classifier_t *occurrence,
    1725             :                                                             const data_feature_t *feat_occur )
    1726             : {
    1727           0 :     U8_TRACE_BEGIN();
    1728           0 :     assert( diagramelement_ptr != NULL );
    1729           0 :     assert( parent != NULL );
    1730           0 :     assert( occurrence != NULL );
    1731             :     /* NULL is allowed here: feat_occur */
    1732           0 :     u8_error_t write_error = U8_ERROR_NONE;
    1733             : 
    1734           0 :     U8_TRACE_END_ERR(write_error);
    1735           0 :     return write_error;
    1736             : }
    1737             : 
    1738           0 : u8_error_t document_element_writer_end_diagramelement( document_element_writer_t *this_,
    1739             :                                                        const data_diagram_t *parent,
    1740             :                                                        const data_diagramelement_t *diagramelement_ptr )
    1741             : {
    1742           0 :     U8_TRACE_BEGIN();
    1743           0 :     assert( diagramelement_ptr != NULL );
    1744           0 :     assert( parent != NULL );
    1745           0 :     u8_error_t write_error = U8_ERROR_NONE;
    1746             : 
    1747           0 :     U8_TRACE_END_ERR(write_error);
    1748           0 :     return write_error;
    1749             : }
    1750             : 
    1751           0 : u8_error_t document_element_writer_end_main( document_element_writer_t *this_ )
    1752             : {
    1753           0 :     U8_TRACE_BEGIN();
    1754           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1755             : 
    1756           0 :     switch ( (*this_).export_type )
    1757             :     {
    1758           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1759             :         {
    1760             :             /* no main end */
    1761             :         }
    1762           0 :         break;
    1763             : 
    1764           0 :         case IO_FILE_FORMAT_HTML:
    1765             :         {
    1766           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1767           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_ARTICLE_END );
    1768             :         }
    1769           0 :         break;
    1770             : 
    1771           0 :         case IO_FILE_FORMAT_TXT:
    1772             :         {
    1773             :             /* no main end */
    1774             :         }
    1775           0 :         break;
    1776             : 
    1777           0 :         default:
    1778             :         {
    1779           0 :             U8_LOG_ERROR("error: unknown_format.");
    1780           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1781             :         }
    1782           0 :         break;
    1783             :     }
    1784             : 
    1785           0 :     U8_TRACE_END_ERR(export_err);
    1786           0 :     return export_err;
    1787             : }
    1788             : 
    1789           0 : u8_error_t document_element_writer_write_footer( document_element_writer_t *this_ )
    1790             : {
    1791           0 :     U8_TRACE_BEGIN();
    1792           0 :     u8_error_t export_err = U8_ERROR_NONE;
    1793             : 
    1794           0 :     switch ( (*this_).export_type )
    1795             :     {
    1796           0 :         case IO_FILE_FORMAT_DOCBOOK:
    1797             :         {
    1798           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1799           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), DOCBOOK_DOC_END );
    1800             :         }
    1801           0 :         break;
    1802             : 
    1803           0 :         case IO_FILE_FORMAT_HTML:
    1804             :         {
    1805           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_FOOTER );
    1806           0 :             io_xml_writer_decrease_indent ( &((*this_).xml_writer) );
    1807           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_BODY_END );
    1808           0 :             export_err |= io_xml_writer_write_plain ( &((*this_).xml_writer), HTML_DOC_END );
    1809             :         }
    1810           0 :         break;
    1811             : 
    1812           0 :         case IO_FILE_FORMAT_TXT:
    1813             :         {
    1814             :             /* no footer */
    1815             :         }
    1816           0 :         break;
    1817             : 
    1818           0 :         default:
    1819             :         {
    1820           0 :             U8_LOG_ERROR("error: unknown_format.");
    1821           0 :             export_err = U8_ERROR_CONFIG_OUT_OF_RANGE;
    1822             :         }
    1823           0 :         break;
    1824             :     }
    1825             : 
    1826           0 :     U8_TRACE_END_ERR( export_err );
    1827           0 :     return export_err;
    1828             : }
    1829             : 
    1830             : 
    1831             : /*
    1832             : Copyright 2017-2024 Andreas Warnke
    1833             : 
    1834             : Licensed under the Apache License, Version 2.0 (the "License");
    1835             : you may not use this file except in compliance with the License.
    1836             : You may obtain a copy of the License at
    1837             : 
    1838             :     http://www.apache.org/licenses/LICENSE-2.0
    1839             : 
    1840             : Unless required by applicable law or agreed to in writing, software
    1841             : distributed under the License is distributed on an "AS IS" BASIS,
    1842             : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    1843             : See the License for the specific language governing permissions and
    1844             : limitations under the License.
    1845             : */

Generated by: LCOV version 1.16