| 1 | :- module(pltables_export, [ | |
| 2 | tables_to_html/2, | |
| 3 | tables_to_html_stream/2, | |
| 4 | tables_to_latex/2, | |
| 5 | tables_to_latex_stream/2, | |
| 6 | tables_to_xml/2, | |
| 7 | tables_to_xml_stream/2, | |
| 8 | tables_to_csv/2, | |
| 9 | tables_to_csv_stream/2 | |
| 10 | ]). | |
| 11 | ||
| 12 | :- use_module(probsrc(self_check)). | |
| 13 | :- use_module(probsrc(module_information)). | |
| 14 | ||
| 15 | :- module_info(group,pltables). | |
| 16 | :- module_info(description,'This module provides html/latex and codespeed export functionality for the other table modules'). | |
| 17 | ||
| 18 | :- use_module(pltables_export_html). | |
| 19 | :- use_module(pltables_export_latex). | |
| 20 | :- use_module(pltables_export_xml). | |
| 21 | :- use_module(pltables_export_csv). | |
| 22 | ||
| 23 | % ---- | |
| 24 | % exported predicates | |
| 25 | % ---- | |
| 26 | tables_to_html(Tables, File) :- | |
| 27 | open(File, write, Stream), | |
| 28 | html_header(Stream, TableName), | |
| 29 | tables_to_html2(Tables, Stream), | |
| 30 | html_footer(Stream, TableName), | |
| 31 | close(Stream). | |
| 32 | ||
| 33 | tables_to_html_stream(Tables, Stream) :- | |
| 34 | html_header(Stream, TableName), | |
| 35 | tables_to_html2(Tables, Stream), | |
| 36 | html_footer(Stream, TableName). | |
| 37 | ||
| 38 | tables_to_latex(Tables, File) :- | |
| 39 | open(File, write, Stream), | |
| 40 | latex_header(Stream, TableName), | |
| 41 | tables_to_latex2(Tables, Stream), | |
| 42 | latex_footer(Stream, TableName), | |
| 43 | close(Stream). | |
| 44 | ||
| 45 | tables_to_latex_stream(Tables, Stream) :- | |
| 46 | latex_header(Stream, TableName), | |
| 47 | tables_to_latex2(Tables, Stream), | |
| 48 | latex_footer(Stream, TableName). | |
| 49 | ||
| 50 | tables_to_xml(Tables, File) :- | |
| 51 | open(File, write, Stream), | |
| 52 | xml_header(Stream, TableName), | |
| 53 | tables_to_xml2(Tables, Stream), | |
| 54 | xml_footer(Stream, TableName), | |
| 55 | close(Stream). | |
| 56 | ||
| 57 | tables_to_xml_stream(Tables, Stream) :- | |
| 58 | xml_header(Stream, TableName), | |
| 59 | tables_to_xml2(Tables, Stream), | |
| 60 | xml_footer(Stream, TableName). | |
| 61 | ||
| 62 | tables_to_csv(Tables, File) :- | |
| 63 | open(File, write, Stream), | |
| 64 | csv_header(Stream, TableName), | |
| 65 | tables_to_csv2(Tables, Stream), | |
| 66 | csv_footer(Stream, TableName), | |
| 67 | close(Stream). | |
| 68 | ||
| 69 | tables_to_csv_stream(Tables, Stream) :- | |
| 70 | csv_header(Stream, TableName), | |
| 71 | tables_to_csv2(Tables, Stream), | |
| 72 | csv_footer(Stream, TableName). | |
| 73 | ||
| 74 | % ---- | |
| 75 | % split predicates | |
| 76 | % ---- | |
| 77 | tables_to_html2([],_S). | |
| 78 | tables_to_html2([Table|Tables],Stream) :- | |
| 79 | table_to_html(Table,Stream), | |
| 80 | tables_to_html2(Tables,Stream). | |
| 81 | ||
| 82 | table_to_html(TableName, Stream) :- | |
| 83 | html_table_header(Stream,TableName), | |
| 84 | html_table_rows(Stream,TableName), | |
| 85 | html_table_footer(Stream,TableName). | |
| 86 | ||
| 87 | tables_to_latex2([],_S). | |
| 88 | tables_to_latex2([Table|Tables],Stream) :- | |
| 89 | table_to_latex(Table,Stream), | |
| 90 | tables_to_latex2(Tables,Stream). | |
| 91 | ||
| 92 | table_to_latex(TableName, Stream) :- | |
| 93 | latex_table_header(Stream, TableName), | |
| 94 | latex_table_rows(Stream, TableName), | |
| 95 | latex_table_footer(Stream,TableName). | |
| 96 | ||
| 97 | tables_to_xml2([],_S). | |
| 98 | tables_to_xml2([Table|Tables],Stream) :- | |
| 99 | table_to_xml(Table,Stream), | |
| 100 | tables_to_xml2(Tables,Stream). | |
| 101 | ||
| 102 | table_to_xml(TableName, Stream) :- | |
| 103 | xml_table_header(Stream, TableName), | |
| 104 | xml_table_rows(Stream, TableName), | |
| 105 | xml_table_footer(Stream,TableName). | |
| 106 | ||
| 107 | tables_to_csv2([],_S). | |
| 108 | tables_to_csv2([Table|Tables],Stream) :- | |
| 109 | table_to_csv(Table,Stream), | |
| 110 | tables_to_csv2(Tables,Stream). | |
| 111 | ||
| 112 | table_to_csv(TableName, Stream) :- | |
| 113 | csv_table_header(Stream, TableName), | |
| 114 | csv_table_rows(Stream, TableName), | |
| 115 | csv_table_footer(Stream,TableName). |