Graphviz
16.0.0~dev.20260810.2334
Loading...
Searching...
No Matches
htmltable.h
Go to the documentation of this file.
1
3
/*************************************************************************
4
* Copyright (c) 2011 AT&T Intellectual Property
5
* All rights reserved. This program and the accompanying materials
6
* are made available under the terms of the Eclipse Public License v2.0
7
* which accompanies this distribution, and is available at
8
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
9
*
10
* Contributors: Details at https://graphviz.org
11
*************************************************************************/
12
13
#pragma once
14
15
#include <
common/textspan.h
>
16
#include <
common/types.h
>
17
#include <stdbool.h>
18
#include <stdint.h>
19
#include <stdlib.h>
20
#include <
util/list.h
>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
#define FIXED_FLAG 1
27
#define HALIGN_RIGHT (1 << 1)
28
#define HALIGN_LEFT (1 << 2)
29
#define HALIGN_MASK (HALIGN_RIGHT | HALIGN_LEFT)
30
#define HALIGN_TEXT HALIGN_MASK
31
#define VALIGN_TOP (1 << 3)
32
#define VALIGN_BOTTOM (1 << 4)
33
#define VALIGN_MASK (VALIGN_TOP | VALIGN_BOTTOM)
34
#define BORDER_SET (1 << 5)
35
#define PAD_SET (1 << 6)
36
#define SPACE_SET (1 << 7)
37
#define BALIGN_RIGHT (1 << 8)
38
#define BALIGN_LEFT (1 << 9)
39
#define BALIGN_MASK (BALIGN_RIGHT | BALIGN_LEFT)
40
#define BORDER_LEFT (1 << 10)
41
#define BORDER_TOP (1 << 11)
42
#define BORDER_RIGHT (1 << 12)
43
#define BORDER_BOTTOM (1 << 13)
44
#define BORDER_MASK (BORDER_LEFT | BORDER_TOP | BORDER_RIGHT | BORDER_BOTTOM)
45
46
#define UNSET_ALIGN 0
47
48
/* spans of text within a cell
49
* NOTE: As required, the str field in span is utf-8.
50
* This translation is done when libexpat scans the input.
51
*/
52
53
/* line of textspan_t's */
54
typedef
struct
{
55
textspan_t
*
items
;
56
size_t
nitems
;
57
char
just
;
58
double
size
;
/* width of span */
59
double
lfsize
;
/* offset from previous baseline to current one */
60
}
htextspan_t
;
61
62
typedef
struct
{
63
htextspan_t
*
spans
;
64
size_t
nspans
;
65
char
simple
;
66
boxf
box
;
67
}
htmltxt_t
;
68
69
typedef
struct
{
70
boxf
box
;
71
char
*
src
;
72
char
*
scale
;
73
}
htmlimg_t
;
74
75
typedef
struct
{
76
bool
radial
: 1;
77
bool
rounded
: 1;
78
bool
invisible
: 1;
79
bool
dotted
: 1;
80
bool
dashed
: 1;
81
}
htmlstyle_t
;
82
83
typedef
struct
{
84
char
*
href
;
/* pointer to an external resource */
85
char
*
port
;
86
char
*
target
;
87
char
*
title
;
88
char
*
id
;
89
char
*
bgcolor
;
90
char
*
pencolor
;
91
int
gradientangle
;
92
signed
char
space
;
93
unsigned
char
border
;
94
unsigned
char
pad
;
95
unsigned
char
sides
;
/* set of sides exposed to field */
96
unsigned
short
flags
;
97
unsigned
short
width
;
98
unsigned
short
height
;
99
htmlstyle_t
style
;
100
boxf
box
;
/* its geometric placement in points */
101
}
htmldata_t
;
102
103
typedef
enum
{
HTML_UNSET
= 0,
HTML_TBL
,
HTML_TEXT
,
HTML_IMAGE
}
label_type_t
;
104
105
typedef
struct
htmlcell_t
htmlcell_t
;
106
typedef
struct
htmltbl_t
htmltbl_t
;
107
108
/* During parsing, table contents are stored as rows of cells.
109
* A row is a list of cells
110
* Rows is a list of rows.
111
*/
112
113
typedef
struct
{
114
LIST
(
htmlcell_t
*) rp;
115
bool
ruled
;
116
}
row_t
;
117
119
static
inline
void
free_ritem
(
row_t
*p) {
120
LIST_FREE
(&p->rp);
121
free
(p);
122
}
123
124
typedef
LIST
(
row_t
*) rows_t;
125
126
struct
htmltbl_t
{
127
htmldata_t
data
;
128
union
{
129
struct
{
130
htmlcell_t
*
parent
;
/* enclosing cell */
131
htmlcell_t
**
cells
;
/* cells */
132
};
133
struct
{
134
htmltbl_t
*
prev
;
/* stack */
135
rows_t
rows
;
136
};
137
};
138
int8_t
cellborder
;
139
double
*
heights
;
140
double
*
widths
;
141
size_t
row_count
;
142
size_t
column_count
;
143
textfont_t
*
font
;
/* font info */
144
bool
hrule
: 1;
145
bool
vrule
: 1;
146
};
147
148
struct
htmllabel_t
{
149
union
{
150
htmltbl_t
*
tbl
;
151
htmltxt_t
*
txt
;
152
htmlimg_t
*
img
;
153
}
u
;
154
label_type_t
kind
;
155
};
156
157
struct
htmlcell_t
{
158
htmldata_t
data
;
159
uint16_t
colspan
;
160
uint16_t
rowspan
;
161
uint16_t
col
;
162
uint16_t
row
;
163
htmllabel_t
child
;
164
htmltbl_t
*
parent
;
165
bool
vruled
: 1;
166
bool
hruled
: 1;
167
};
168
169
typedef
struct
{
170
pointf
pos
;
171
textfont_t
finfo
;
172
void
*
obj
;
173
graph_t
*
g
;
174
char
*
imgscale
;
175
char
*
objid
;
176
bool
objid_set
;
177
}
htmlenv_t
;
178
179
htmllabel_t
*
parseHTML
(
char
*,
int
*,
htmlenv_t
*);
180
181
int
make_html_label
(
void
*obj,
textlabel_t
*lp);
182
void
emit_html_label
(
GVJ_t
*job,
htmllabel_t
*lp,
textlabel_t
*);
183
184
void
free_html_label
(
htmllabel_t
*,
int
);
185
void
free_html_data
(
htmldata_t
*);
186
void
free_html_text
(
htmltxt_t
*);
187
188
boxf
*
html_port
(
node_t
*n,
char
*pname,
unsigned
char
*sides);
189
190
#ifdef __cplusplus
191
}
192
#endif
free
void free(void *)
free_html_label
void free_html_label(htmllabel_t *, int)
Definition
htmltable.c:863
emit_html_label
void emit_html_label(GVJ_t *job, htmllabel_t *lp, textlabel_t *)
Definition
htmltable.c:747
free_html_data
void free_html_data(htmldata_t *)
Definition
htmltable.c:794
html_port
boxf * html_port(node_t *n, char *pname, unsigned char *sides)
Definition
htmltable.c:918
make_html_label
int make_html_label(void *obj, textlabel_t *lp)
Return non-zero if problem parsing HTML. In this case, use object name.
Definition
htmltable.c:1858
free_html_text
void free_html_text(htmltxt_t *)
Definition
htmltable.c:805
parseHTML
htmllabel_t * parseHTML(char *, int *, htmlenv_t *)
Definition
htmlparse.c:2010
free_ritem
static void free_ritem(row_t *p)
Free row. This closes and frees row’s list, then the item itself is freed.
Definition
htmltable.h:119
label_type_t
label_type_t
Definition
htmltable.h:103
HTML_TBL
@ HTML_TBL
Definition
htmltable.h:103
HTML_UNSET
@ HTML_UNSET
Definition
htmltable.h:103
HTML_TEXT
@ HTML_TEXT
Definition
htmltable.h:103
HTML_IMAGE
@ HTML_IMAGE
Definition
htmltable.h:103
list.h
type-generic dynamically expanding list
LIST
#define LIST(type)
Definition
list.h:55
LIST_FREE
#define LIST_FREE(list)
Definition
list.h:350
Agnode_s
Definition
cgraph.h:259
Agraph_s
graph or subgraph
Definition
cgraph.h:424
GVJ_s
Definition
gvcjob.h:262
boxf
Definition
geom.h:41
htextspan_t
Definition
htmltable.h:54
htextspan_t::lfsize
double lfsize
Definition
htmltable.h:59
htextspan_t::nitems
size_t nitems
Definition
htmltable.h:56
htextspan_t::just
char just
Definition
htmltable.h:57
htextspan_t::items
textspan_t * items
Definition
htmltable.h:55
htextspan_t::size
double size
Definition
htmltable.h:58
htmlcell_t
Definition
htmltable.h:157
htmlcell_t::rowspan
uint16_t rowspan
Definition
htmltable.h:160
htmlcell_t::child
htmllabel_t child
Definition
htmltable.h:163
htmlcell_t::colspan
uint16_t colspan
Definition
htmltable.h:159
htmlcell_t::parent
htmltbl_t * parent
Definition
htmltable.h:164
htmlcell_t::vruled
bool vruled
vertically ruled?
Definition
htmltable.h:165
htmlcell_t::hruled
bool hruled
horizontally ruled?
Definition
htmltable.h:166
htmlcell_t::col
uint16_t col
Definition
htmltable.h:161
htmlcell_t::row
uint16_t row
Definition
htmltable.h:162
htmlcell_t::data
htmldata_t data
Definition
htmltable.h:158
htmldata_t
Definition
htmltable.h:83
htmldata_t::bgcolor
char * bgcolor
Definition
htmltable.h:89
htmldata_t::border
unsigned char border
Definition
htmltable.h:93
htmldata_t::target
char * target
Definition
htmltable.h:86
htmldata_t::id
char * id
Definition
htmltable.h:88
htmldata_t::space
signed char space
Definition
htmltable.h:92
htmldata_t::width
unsigned short width
Definition
htmltable.h:97
htmldata_t::height
unsigned short height
Definition
htmltable.h:98
htmldata_t::gradientangle
int gradientangle
Definition
htmltable.h:91
htmldata_t::box
boxf box
Definition
htmltable.h:100
htmldata_t::port
char * port
Definition
htmltable.h:85
htmldata_t::flags
unsigned short flags
Definition
htmltable.h:96
htmldata_t::sides
unsigned char sides
Definition
htmltable.h:95
htmldata_t::href
char * href
Definition
htmltable.h:84
htmldata_t::pad
unsigned char pad
Definition
htmltable.h:94
htmldata_t::pencolor
char * pencolor
Definition
htmltable.h:90
htmldata_t::style
htmlstyle_t style
Definition
htmltable.h:99
htmldata_t::title
char * title
Definition
htmltable.h:87
htmlenv_t
Definition
htmltable.h:169
htmlenv_t::g
graph_t * g
Definition
htmltable.h:173
htmlenv_t::finfo
textfont_t finfo
Definition
htmltable.h:171
htmlenv_t::pos
pointf pos
Definition
htmltable.h:170
htmlenv_t::objid_set
bool objid_set
Definition
htmltable.h:176
htmlenv_t::objid
char * objid
Definition
htmltable.h:175
htmlenv_t::imgscale
char * imgscale
Definition
htmltable.h:174
htmlenv_t::obj
void * obj
Definition
htmltable.h:172
htmlimg_t
Definition
htmltable.h:69
htmlimg_t::scale
char * scale
Definition
htmltable.h:72
htmlimg_t::src
char * src
Definition
htmltable.h:71
htmlimg_t::box
boxf box
Definition
htmltable.h:70
htmllabel_t
Definition
htmltable.h:148
htmllabel_t::txt
htmltxt_t * txt
Definition
htmltable.h:151
htmllabel_t::tbl
htmltbl_t * tbl
Definition
htmltable.h:150
htmllabel_t::img
htmlimg_t * img
Definition
htmltable.h:152
htmllabel_t::kind
label_type_t kind
Definition
htmltable.h:154
htmllabel_t::u
union htmllabel_t::@50 u
htmlstyle_t
Definition
htmltable.h:75
htmlstyle_t::dashed
bool dashed
Definition
htmltable.h:80
htmlstyle_t::dotted
bool dotted
Definition
htmltable.h:79
htmlstyle_t::rounded
bool rounded
Definition
htmltable.h:77
htmlstyle_t::radial
bool radial
Definition
htmltable.h:76
htmlstyle_t::invisible
bool invisible
Definition
htmltable.h:78
htmltbl_t
Definition
htmltable.h:126
htmltbl_t::vrule
bool vrule
vertical rule
Definition
htmltable.h:145
htmltbl_t::font
textfont_t * font
Definition
htmltable.h:143
htmltbl_t::row_count
size_t row_count
number of rows
Definition
htmltable.h:141
htmltbl_t::hrule
bool hrule
horizontal rule
Definition
htmltable.h:144
htmltbl_t::widths
double * widths
widths of the columns
Definition
htmltable.h:140
htmltbl_t::prev
htmltbl_t * prev
Definition
htmltable.h:134
htmltbl_t::cells
htmlcell_t ** cells
Definition
htmltable.h:131
htmltbl_t::data
htmldata_t data
Definition
htmltable.h:127
htmltbl_t::rows
rows_t rows
cells
Definition
htmltable.h:135
htmltbl_t::parent
htmlcell_t * parent
Definition
htmltable.h:130
htmltbl_t::heights
double * heights
heights of the rows
Definition
htmltable.h:139
htmltbl_t::cellborder
int8_t cellborder
Definition
htmltable.h:138
htmltbl_t::column_count
size_t column_count
number of columns
Definition
htmltable.h:142
htmltxt_t
Definition
htmltable.h:62
htmltxt_t::box
boxf box
Definition
htmltable.h:66
htmltxt_t::nspans
size_t nspans
Definition
htmltable.h:64
htmltxt_t::simple
char simple
Definition
htmltable.h:65
htmltxt_t::spans
htextspan_t * spans
Definition
htmltable.h:63
pointf_s
Definition
geom.h:29
row_t
Definition
htmltable.h:113
row_t::ruled
bool ruled
Definition
htmltable.h:115
row_t::LIST
LIST(htmlcell_t *) rp
textfont_t
Definition
textspan.h:55
textlabel_t
Definition
types.h:104
textspan_t
Definition
textspan.h:67
textspan.h
textspan_t, textfont_t, PostscriptAlias
types.h
graphs, nodes and edges info: Agraphinfo_t, Agnodeinfo_t and Agedgeinfo_t
lib
common
htmltable.h
Generated by
1.9.8