Graphviz 12.0.1~dev.20240716.0800
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 v1.0
7 * which accompanies this distribution, and is available at
8 * https://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors: Details at https://graphviz.org
11 *************************************************************************/
12
13#pragma once
14
15#include <stdbool.h>
16#include <stddef.h>
17#include <stdint.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#define FIXED_FLAG 1
24#define HALIGN_RIGHT (1 << 1)
25#define HALIGN_LEFT (1 << 2)
26#define HALIGN_MASK (HALIGN_RIGHT | HALIGN_LEFT)
27#define HALIGN_TEXT HALIGN_MASK
28#define VALIGN_TOP (1 << 3)
29#define VALIGN_BOTTOM (1 << 4)
30#define VALIGN_MASK (VALIGN_TOP | VALIGN_BOTTOM)
31#define BORDER_SET (1 << 5)
32#define PAD_SET (1 << 6)
33#define SPACE_SET (1 << 7)
34#define BALIGN_RIGHT (1 << 8)
35#define BALIGN_LEFT (1 << 9)
36#define BALIGN_MASK (BALIGN_RIGHT | BALIGN_LEFT)
37#define BORDER_LEFT (1 << 10)
38#define BORDER_TOP (1 << 11)
39#define BORDER_RIGHT (1 << 12)
40#define BORDER_BOTTOM (1 << 13)
41#define BORDER_MASK (BORDER_LEFT|BORDER_TOP|BORDER_RIGHT|BORDER_BOTTOM)
42
43#define UNSET_ALIGN 0
44
45 /* spans of text within a cell
46 * NOTE: As required, the str field in span is utf-8.
47 * This translation is done when libexpat scans the input.
48 */
49
50 /* line of textspan_t's */
51 typedef struct {
53 size_t nitems;
54 char just;
55 double size; /* width of span */
56 double lfsize; /* offset from previous baseline to current one */
58
59 typedef struct {
61 size_t nspans;
62 char simple;
64 } htmltxt_t;
65
66 typedef struct {
68 char *src;
69 char *scale;
70 } htmlimg_t;
71
72 typedef struct {
73 bool radial: 1;
74 bool rounded: 1;
75 bool invisible: 1;
76 bool dotted: 1;
77 bool dashed: 1;
79
80 typedef struct {
81 char *href; /* pointer to an external resource */
82 char *port;
83 char *target;
84 char *title;
85 char *id;
86 char *bgcolor;
87 char *pencolor;
89 signed char space;
90 unsigned char border;
91 unsigned char pad;
92 unsigned char sides; /* set of sides exposed to field */
93 unsigned short flags;
94 unsigned short width;
95 unsigned short height;
97 boxf box; /* its geometric placement in points */
98 } htmldata_t;
99
100#define HTML_UNSET 0
101#define HTML_TBL 1
102#define HTML_TEXT 2
103#define HTML_IMAGE 3
104
105#define HTML_VRULE 1
106#define HTML_HRULE 2
107
108 typedef struct htmlcell_t htmlcell_t;
109 typedef struct htmltbl_t htmltbl_t;
110
111 struct htmltbl_t {
113 union {
114 struct {
115 htmlcell_t *parent; /* enclosing cell */
116 htmlcell_t **cells; /* cells */
117 } n;
118 struct {
119 htmltbl_t *prev; /* stack */
120 Dt_t *rows; /* cells */
121 } p;
122 } u;
124 double *heights;
125 double *widths;
126 size_t row_count;
128 textfont_t *font; /* font info */
129 bool hrule:1;
130 bool vrule:1;
131 };
132
133 struct htmllabel_t {
134 union {
138 } u;
139 char kind;
140 };
141
142 struct htmlcell_t {
144 uint16_t colspan;
145 uint16_t rowspan;
146 uint16_t col;
147 uint16_t row;
150 unsigned char ruled;
151 };
152
153/* During parsing, table contents are stored as rows of cells.
154 * A row is a list of cells
155 * Rows is a list of rows.
156 * pitems are used for both lists.
157 */
158 typedef struct {
160 union {
163 } u;
164 unsigned char ruled;
165 } pitem;
166
167 typedef struct {
170 void *obj;
172 char *imgscale;
173 char *objid;
175 } htmlenv_t;
176
177 extern htmllabel_t *parseHTML(char *, int *, htmlenv_t *);
178
179 extern int make_html_label(void *obj, textlabel_t * lp);
180 extern void emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t *);
181
182 extern void free_html_label(htmllabel_t *, int);
183 extern void free_html_data(htmldata_t *);
184 extern void free_html_text(htmltxt_t *);
185
186 extern boxf *html_port(node_t *n, char *pname, unsigned char *sides);
187
188#ifdef __cplusplus
189}
190#endif
void free_html_label(htmllabel_t *, int)
Definition htmltable.c:876
void emit_html_label(GVJ_t *job, htmllabel_t *lp, textlabel_t *)
Definition htmltable.c:756
void free_html_data(htmldata_t *)
Definition htmltable.c:803
boxf * html_port(node_t *n, char *pname, unsigned char *sides)
Definition htmltable.c:934
int make_html_label(void *obj, textlabel_t *lp)
Definition htmltable.c:1987
void free_html_text(htmltxt_t *)
Definition htmltable.c:814
htmllabel_t * parseHTML(char *, int *, htmlenv_t *)
Definition htmlparse.c:2431
graph or subgraph
Definition cgraph.h:425
Definition cdt.h:104
Definition geom.h:41
double lfsize
Definition htmltable.h:56
size_t nitems
Definition htmltable.h:53
textspan_t * items
Definition htmltable.h:52
double size
Definition htmltable.h:55
uint16_t rowspan
Definition htmltable.h:145
htmllabel_t child
Definition htmltable.h:148
uint16_t colspan
Definition htmltable.h:144
htmltbl_t * parent
Definition htmltable.h:149
unsigned char ruled
Definition htmltable.h:150
uint16_t col
Definition htmltable.h:146
uint16_t row
Definition htmltable.h:147
htmldata_t data
Definition htmltable.h:143
char * bgcolor
Definition htmltable.h:86
unsigned char border
Definition htmltable.h:90
char * target
Definition htmltable.h:83
char * id
Definition htmltable.h:85
signed char space
Definition htmltable.h:89
unsigned short width
Definition htmltable.h:94
unsigned short height
Definition htmltable.h:95
int gradientangle
Definition htmltable.h:88
char * port
Definition htmltable.h:82
unsigned short flags
Definition htmltable.h:93
unsigned char sides
Definition htmltable.h:92
char * href
Definition htmltable.h:81
unsigned char pad
Definition htmltable.h:91
char * pencolor
Definition htmltable.h:87
htmlstyle_t style
Definition htmltable.h:96
char * title
Definition htmltable.h:84
graph_t * g
Definition htmltable.h:171
textfont_t finfo
Definition htmltable.h:169
pointf pos
Definition htmltable.h:168
bool objid_set
Definition htmltable.h:174
char * objid
Definition htmltable.h:173
char * imgscale
Definition htmltable.h:172
void * obj
Definition htmltable.h:170
char * scale
Definition htmltable.h:69
char * src
Definition htmltable.h:68
boxf box
Definition htmltable.h:67
htmltxt_t * txt
Definition htmltable.h:136
union htmllabel_t::@78 u
htmltbl_t * tbl
Definition htmltable.h:135
htmlimg_t * img
Definition htmltable.h:137
bool dashed
Definition htmltable.h:77
bool dotted
Definition htmltable.h:76
bool rounded
Definition htmltable.h:74
bool radial
Definition htmltable.h:73
bool invisible
Definition htmltable.h:75
bool vrule
vertical rule
Definition htmltable.h:130
union htmltbl_t::@75 u
textfont_t * font
Definition htmltable.h:128
size_t row_count
number of rows
Definition htmltable.h:126
bool hrule
horizontal rule
Definition htmltable.h:129
double * widths
widths of the columns
Definition htmltable.h:125
htmltbl_t * prev
Definition htmltable.h:119
struct htmltbl_t::@75::@76 n
struct htmltbl_t::@75::@77 p
htmlcell_t ** cells
Definition htmltable.h:116
htmldata_t data
Definition htmltable.h:112
Dt_t * rows
Definition htmltable.h:120
htmlcell_t * parent
Definition htmltable.h:115
double * heights
heights of the rows
Definition htmltable.h:124
int8_t cellborder
Definition htmltable.h:123
size_t column_count
number of columns
Definition htmltable.h:127
boxf box
Definition htmltable.h:63
size_t nspans
Definition htmltable.h:61
char simple
Definition htmltable.h:62
htextspan_t * spans
Definition htmltable.h:60
unsigned char ruled
Definition htmltable.h:164
Dt_t * rp
Definition htmltable.h:161
Dtlink_t link
Definition htmltable.h:159
htmlcell_t * cp
Definition htmltable.h:162