Graphviz  2.41.20171026.1811
htmltable.h
Go to the documentation of this file.
1 /* $Id$ $Revision$ */
2 /* vim:set shiftwidth=4 ts=8: */
3 
4 /*************************************************************************
5  * Copyright (c) 2011 AT&T Intellectual Property
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the Eclipse Public License v1.0
8  * which accompanies this distribution, and is available at
9  * http://www.eclipse.org/legal/epl-v10.html
10  *
11  * Contributors: See CVS logs. Details at http://www.graphviz.org/
12  *************************************************************************/
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #ifndef TABLE_H
19 #define TABLE_H
20 
21 #define FIXED_FLAG 1
22 #define HALIGN_RIGHT (1 << 1)
23 #define HALIGN_LEFT (1 << 2)
24 #define HALIGN_MASK (HALIGN_RIGHT | HALIGN_LEFT)
25 #define HALIGN_TEXT HALIGN_MASK
26 #define VALIGN_TOP (1 << 3)
27 #define VALIGN_BOTTOM (1 << 4)
28 #define VALIGN_MASK (VALIGN_TOP | VALIGN_BOTTOM)
29 #define BORDER_SET (1 << 5)
30 #define PAD_SET (1 << 6)
31 #define SPACE_SET (1 << 7)
32 #define BALIGN_RIGHT (1 << 8)
33 #define BALIGN_LEFT (1 << 9)
34 #define BALIGN_MASK (BALIGN_RIGHT | BALIGN_LEFT)
35 #define BORDER_LEFT (1 << 10)
36 #define BORDER_TOP (1 << 11)
37 #define BORDER_RIGHT (1 << 12)
38 #define BORDER_BOTTOM (1 << 13)
39 #define BORDER_MASK (BORDER_LEFT|BORDER_TOP|BORDER_RIGHT|BORDER_BOTTOM)
40 
41 #define UNSET_ALIGN 0
42 
43  /* spans of text within a cell
44  * NOTE: As required, the str field in span is utf-8.
45  * This translation is done when libexpat scans the input.
46  */
47 
48  /* line of textspan_t's */
49  typedef struct {
51  short nitems;
52  char just;
53  double size; /* width of span */
54  double lfsize; /* offset from previous baseline to current one */
55  } htextspan_t;
56 
57  typedef struct {
59  short nspans;
60  char simple;
62  } htmltxt_t;
63 
64  typedef struct {
66  char *src;
67  char *scale;
68  } htmlimg_t;
69 
70  typedef struct {
71  char *href; /* pointer to an external resource */
72  char *port;
73  char *target;
74  char *title;
75  char *id;
76  char *bgcolor;
77  char *pencolor;
79  signed char space;
80  unsigned char border;
81  unsigned char pad;
82  unsigned char sides; /* set of sides exposed to field */
83  unsigned short flags;
84  unsigned short width;
85  unsigned short height;
86  unsigned short style;
87  boxf box; /* its geometric placement in points */
88  } htmldata_t;
89 
90 #define HTML_UNSET 0
91 #define HTML_TBL 1
92 #define HTML_TEXT 2
93 #define HTML_IMAGE 3
94 
95 #define HTML_VRULE 1
96 #define HTML_HRULE 2
97 
98  typedef struct htmlcell_t htmlcell_t;
99  typedef struct htmltbl_t htmltbl_t;
100 
101  struct htmltbl_t {
103  union {
104  struct {
105  htmlcell_t *parent; /* enclosing cell */
106  htmlcell_t **cells; /* cells */
107  } n;
108  struct {
109  htmltbl_t *prev; /* stack */
110  Dt_t *rows; /* cells */
111  } p;
112  } u;
113  signed char cb; /* cell border */
114  int *heights; /* heights of the rows */
115  int *widths; /* widths of the columns */
116  int rc; /* number of rows */
117  int cc; /* number of columns */
118  textfont_t *font; /* font info */
119  unsigned char flags;
120  };
121 
122  struct htmllabel_t {
123  union {
127  } u;
128  char kind;
129  };
130 
131  struct htmlcell_t {
133  unsigned short cspan;
134  unsigned short rspan;
135  unsigned short col;
136  unsigned short row;
139  unsigned char ruled;
140  };
141 
142 /* During parsing, table contents are stored as rows of cells.
143  * A row is a list of cells
144  * Rows is a list of rows.
145  * pitems are used for both lists.
146  */
147  typedef struct {
149  union {
152  } u;
153  unsigned char ruled;
154  } pitem;
155 
156  typedef struct {
159  void *obj;
161  char *imgscale;
162  char *objid;
163  boolean objid_set;
164  } htmlenv_t;
165 
166  extern htmllabel_t *parseHTML(char *, int *, htmlenv_t *);
167 
168  extern int make_html_label(void *obj, textlabel_t * lp);
169  extern void emit_html_label(GVJ_t * job, htmllabel_t * lp, textlabel_t *);
170 
171  extern void free_html_label(htmllabel_t *, int);
172  extern void free_html_data(htmldata_t *);
173  extern void free_html_text(htmltxt_t *);
174 
175  extern boxf *html_port(node_t * n, char *pname, int* sides);
176  extern int html_path(node_t * n, port* p, int side, boxf * rv, int *k);
177  extern int html_inside(node_t * n, pointf p, edge_t * e);
178 
179 #endif
180 
181 #ifdef __cplusplus
182 }
183 #endif
unsigned short rspan
Definition: htmltable.h:134
double size
Definition: htmltable.h:53
Definition: types.h:67
int * widths
Definition: htmltable.h:115
htmlcell_t * parent
Definition: htmltable.h:105
int html_inside(node_t *n, pointf p, edge_t *e)
htmldata_t data
Definition: htmltable.h:102
htmltxt_t * txt
Definition: htmltable.h:125
signed char space
Definition: htmltable.h:79
pointf pos
Definition: htmltable.h:157
char * objid
Definition: htmltable.h:162
char * port
Definition: htmltable.h:72
Definition: geom.h:28
htmllabel_t * parseHTML(char *txt, int *warn, htmlenv_t *env)
Definition: htmlparse.c:2516
char simple
Definition: htmltable.h:60
struct htmltbl_t::@12::@13 n
union htmltbl_t::@12 u
unsigned short cspan
Definition: htmltable.h:133
unsigned short col
Definition: htmltable.h:135
int make_html_label(void *obj, textlabel_t *lp)
Definition: htmltable.c:2057
htmlcell_t ** cells
Definition: htmltable.h:106
unsigned char border
Definition: htmltable.h:80
boxf box
Definition: htmltable.h:61
boxf box
Definition: htmltable.h:65
int html_path(node_t *n, port *p, int side, boxf *rv, int *k)
Definition: htmltable.c:959
Definition: gvcjob.h:271
char * scale
Definition: htmltable.h:67
void free_html_text(htmltxt_t *t)
Definition: htmltable.c:805
char * pencolor
Definition: htmltable.h:77
char * imgscale
Definition: htmltable.h:161
graph_t * g
Definition: htmltable.h:160
unsigned short flags
Definition: htmltable.h:83
int gradientangle
Definition: htmltable.h:78
boxf box
Definition: htmltable.h:87
void free_html_label(htmllabel_t *lp, int root)
Definition: htmltable.c:870
unsigned short width
Definition: htmltable.h:84
void * obj
Definition: htmltable.h:159
char * href
Definition: htmltable.h:71
unsigned char flags
Definition: htmltable.h:119
double lfsize
Definition: htmltable.h:54
Dtlink_t link
Definition: htmltable.h:148
htmlcell_t * cp
Definition: htmltable.h:151
unsigned short style
Definition: htmltable.h:86
short nitems
Definition: htmltable.h:51
unsigned short row
Definition: htmltable.h:136
struct htmltbl_t::@12::@14 p
signed char cb
Definition: htmltable.h:113
unsigned char sides
Definition: htmltable.h:82
char * src
Definition: htmltable.h:66
unsigned char pad
Definition: htmltable.h:81
htmllabel_t child
Definition: htmltable.h:137
void free_html_data(htmldata_t *dp)
Definition: htmltable.c:794
union htmllabel_t::@15 u
textfont_t * font
Definition: htmltable.h:118
void emit_html_label(GVJ_t *job, htmllabel_t *lp, textlabel_t *tp)
Definition: htmltable.c:747
char * title
Definition: htmltable.h:74
unsigned short height
Definition: htmltable.h:85
htmldata_t data
Definition: htmltable.h:132
htmltbl_t * parent
Definition: htmltable.h:138
htmlimg_t * img
Definition: htmltable.h:126
boxf * html_port(node_t *n, char *pname, int *sides)
Definition: htmltable.c:928
unsigned char ruled
Definition: htmltable.h:139
htmltbl_t * tbl
Definition: htmltable.h:124
Definition: cdt.h:99
char * target
Definition: htmltable.h:73
htextspan_t * spans
Definition: htmltable.h:58
char just
Definition: htmltable.h:52
Dt_t * rp
Definition: htmltable.h:150
short nspans
Definition: htmltable.h:59
char * bgcolor
Definition: htmltable.h:76
Dt_t * rows
Definition: htmltable.h:110
textfont_t finfo
Definition: htmltable.h:158
Definition: geom.h:35
boolean objid_set
Definition: htmltable.h:163
htmltbl_t * prev
Definition: htmltable.h:109
int * heights
Definition: htmltable.h:114
char * id
Definition: htmltable.h:75
textspan_t * items
Definition: htmltable.h:50
unsigned char ruled
Definition: htmltable.h:153