source: tools/tracereport/output.c @ 8485d99

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivendag_formatrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 8485d99 was ee6e802, checked in by Shane Alcock <salcock@…>, 5 years ago

Updated copyright blurb on all source files

In some cases, this meant adding copyright blurbs to files that
had never had them before.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*
2 *
3 * Copyright (c) 2007-2016 The University of Waikato, Hamilton, New Zealand.
4 * All rights reserved.
5 *
6 * This file is part of libtrace.
7 *
8 * This code has been developed by the University of Waikato WAND
9 * research group. For further information please see http://www.wand.net.nz/
10 *
11 * libtrace is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * libtrace is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23 *
24 *
25 */
26
27
28#define _GNU_SOURCE
29#include <stdio.h>
30#include <inttypes.h>
31#include <lt_inttypes.h>
32
33
34enum stats_output_format_t {
35        CSV, TXT, HTML, XML, ODOC
36};
37struct stats_output_t {
38        enum stats_output_format_t type;
39};
40
41struct stats_output_t *create_stats(enum stats_output_format_t format)
42{
43        struct stats_output_t *output=malloc(sizeof(struct stats_output_t));
44        output->type=format;
45        switch (type) {
46                case CSV:
47                        break;
48                case HTML:
49                        printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n");
50                        printf("<html>\n");
51                        printf("<head>\n");
52                        printf(" <title>Report</title>\n");
53                        printf(" <style>\n");
54                        printf("  .table        { border-collapse: collapse; }\n");
55                        printf("  td            { border: thin black solid; }\n");
56                        printf("  .numeric      { text-align: right; }\n");
57                        printf("  .even         { background: #a0e0e0; }\n");
58                        printf("  .odd          { background: #ffffff; }\n");
59                        printf("  .rowheading   { text-align: right; }\n");
60                        printf(" </style>\n");
61                        printf("</head>\n");
62                        printf("<body>\n");
63                        printf("<h1>Report</h1>\n");
64                        printf("<table>\n");
65                        printf(" <tr>\n");
66                        break;
67                case XML:
68                        printf("<?xml version=\"1.0\" charset=\"utf-8\"?>\n");
69                        printf("<results>\n");
70                        printf(" <columnheadings>\n");
71                        break;
72                default:
73                        fprintf(stderr,"Unknown format\n");
74                        break;
75        }
76        return output;
77}
78
79struct stats_output_t *add_column_heading(struct stats_output_t *out,char *heading,...)
80{
81        va_list va;
82        va_start(va,heading);
83        vasprintf(&buf,heading,va);
84        switch (out->type) {
85                case CSV:
86        }
87        va_end(va);
88}
Note: See TracBrowser for help on using the repository browser.