Graphviz 13.0.0~dev.20250121.0651
Loading...
Searching...
No Matches
xdot.h
Go to the documentation of this file.
1
15/*************************************************************************
16 * Copyright (c) 2011 AT&T Intellectual Property
17 * All rights reserved. This program and the accompanying materials
18 * are made available under the terms of the Eclipse Public License v1.0
19 * which accompanies this distribution, and is available at
20 * https://www.eclipse.org/legal/epl-v10.html
21 *
22 * Contributors: Details at https://graphviz.org
23 *************************************************************************/
24
25#pragma once
26
27#include <stddef.h>
28#include <stdio.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#ifdef GVDLL
35#ifdef EXPORT_XDOT
36#define XDOT_API __declspec(dllexport)
37#else
38#define XDOT_API __declspec(dllimport)
39#endif
40#endif
41
42#ifndef XDOT_API
43#define XDOT_API /* nothing */
44#endif
45
47
48typedef struct {
49 float frac;
50 char *color;
52
53typedef struct {
54 double x0, y0;
55 double x1, y1;
59
60typedef struct {
61 double x0, y0, r0;
62 double x1, y1, r1;
66
75
77
78typedef struct {
79 double x, y, z;
81
82typedef struct {
83 double x, y, w, h;
84} xdot_rect;
85
86typedef struct {
87 size_t cnt;
90
91typedef struct {
92 double x, y;
94 double width;
95 char *text;
96} xdot_text;
97
98typedef struct {
100 char *name;
101} xdot_image;
102
103typedef struct {
104 double size;
105 char *name;
106} xdot_font;
107
126
141
142typedef struct _xdot_op xdot_op;
143typedef void (*drawfunc_t)(xdot_op *, int);
144typedef void (*freefunc_t)(xdot_op *);
145
146struct _xdot_op {
148 union {
149 xdot_rect ellipse; /* xd_filled_ellipse, xd_unfilled_ellipse */
150 xdot_polyline polygon; /* xd_filled_polygon, xd_unfilled_polygon */
151 xdot_polyline polyline; /* xd_polyline */
152 xdot_polyline bezier; /* xd_filled_bezier, xd_unfilled_bezier */
153 xdot_text text; /* xd_text */
154 xdot_image image; /* xd_image */
155 char *color; /* xd_fill_color, xd_pen_color */
156 xdot_color grad_color; /* xd_grad_fill_color, xd_grad_pen_color */
157 xdot_font font; /* xd_font */
158 char *style; /* xd_style */
159 unsigned int fontchar; /* xd_fontchar */
160 } u;
162};
163
164#define XDOT_PARSE_ERROR 1
165
166typedef struct {
167 size_t cnt; /* no. of xdot ops */
168 size_t sz; /* sizeof structure containing xdot_op as first field */
171 int flags;
172} xdot;
173
174typedef struct {
175 size_t cnt; /* no. of xdot ops */
176 size_t n_ellipse;
177 size_t n_polygon;
181 size_t n_bezier;
183 size_t n_text;
184 size_t n_font;
185 size_t n_style;
186 size_t n_color;
187 size_t n_image;
190} xdot_stats;
191
192/* ops are indexed by xop_kind */
193XDOT_API xdot *parseXDotF(char *, drawfunc_t opfns[], size_t sz);
194XDOT_API xdot *parseXDotFOn(char *, drawfunc_t opfns[], size_t sz, xdot *);
195XDOT_API xdot *parseXDot(char *);
196XDOT_API char *sprintXDot(xdot *);
197XDOT_API void fprintXDot(FILE *, xdot *);
198XDOT_API void jsonXDot(FILE *, xdot *);
199XDOT_API void freeXDot(xdot *);
200XDOT_API int statXDot(xdot *, xdot_stats *);
202XDOT_API char *parseXDotColor(char *cp, xdot_color *clr);
203XDOT_API void freeXDotColor(xdot_color *);
204
205#ifdef __cplusplus
206}
207#endif
static int z
char * style
Definition xdot.h:158
xdot_font font
Definition xdot.h:157
xdot_polyline polygon
Definition xdot.h:150
xdot_rect ellipse
Definition xdot.h:149
xdot_image image
Definition xdot.h:154
char * color
Definition xdot.h:155
unsigned int fontchar
Definition xdot.h:159
xdot_kind kind
Definition xdot.h:147
xdot_text text
Definition xdot.h:153
xdot_polyline bezier
Definition xdot.h:152
xdot_polyline polyline
Definition xdot.h:151
xdot_color grad_color
Definition xdot.h:156
drawfunc_t drawfunc
Definition xdot.h:161
union _xdot_op::@126 u
char * color
Definition xdot.h:50
float frac
Definition xdot.h:49
xdot_grad_type type
Definition xdot.h:68
xdot_linear_grad ling
Definition xdot.h:71
xdot_radial_grad ring
Definition xdot.h:72
char * clr
Definition xdot.h:70
double size
Definition xdot.h:104
char * name
Definition xdot.h:105
char * name
Definition xdot.h:100
xdot_rect pos
Definition xdot.h:99
xdot_color_stop * stops
Definition xdot.h:57
double x0
Definition xdot.h:54
double x1
Definition xdot.h:55
double x
Definition xdot.h:79
size_t cnt
Definition xdot.h:87
xdot_point * pts
Definition xdot.h:88
double r0
Definition xdot.h:61
double r1
Definition xdot.h:62
xdot_color_stop * stops
Definition xdot.h:64
double h
Definition xdot.h:83
size_t n_image
Definition xdot.h:187
size_t n_polygon_pts
Definition xdot.h:178
size_t cnt
Definition xdot.h:175
size_t n_text
Definition xdot.h:183
size_t n_style
Definition xdot.h:185
size_t n_polyline_pts
Definition xdot.h:180
size_t n_bezier
Definition xdot.h:181
size_t n_polygon
Definition xdot.h:177
size_t n_fontchar
Definition xdot.h:189
size_t n_font
Definition xdot.h:184
size_t n_polyline
Definition xdot.h:179
size_t n_color
Definition xdot.h:186
size_t n_gradcolor
Definition xdot.h:188
size_t n_ellipse
Definition xdot.h:176
size_t n_bezier_pts
Definition xdot.h:182
double width
Definition xdot.h:94
char * text
Definition xdot.h:95
double x
Definition xdot.h:92
xdot_align align
Definition xdot.h:93
Definition xdot.h:166
freefunc_t freefunc
Definition xdot.h:170
xdot_op * ops
Definition xdot.h:169
size_t cnt
Definition xdot.h:167
size_t sz
Definition xdot.h:168
int flags
Definition xdot.h:171
xdot_grad_type
Definition xdot.h:46
@ xd_none
Definition xdot.h:46
@ xd_radial
Definition xdot.h:46
@ xd_linear
Definition xdot.h:46
void fprintXDot(FILE *, xdot *)
Definition xdot.c:712
xdot * parseXDotF(char *, drawfunc_t opfns[], size_t sz)
Definition xdot.c:390
void freeXDotColor(xdot_color *)
Definition xdot.c:950
void freeXDot(xdot *)
Definition xdot.c:760
char * parseXDotColor(char *cp, xdot_color *clr)
Definition xdot.c:924
xdot * parseXDot(char *)
Definition xdot.c:394
xdot_grad_type colorTypeXDot(char *)
void(* freefunc_t)(xdot_op *)
Definition xdot.h:144
xop_kind
Definition xdot.h:127
@ xop_polygon
Definition xdot.h:129
@ xop_font
Definition xdot.h:135
@ xop_image
Definition xdot.h:137
@ xop_bezier
Definition xdot.h:130
@ xop_fill_color
Definition xdot.h:133
@ xop_text
Definition xdot.h:132
@ xop_fontchar
Definition xdot.h:139
@ xop_style
Definition xdot.h:136
@ xop_grad_color
Definition xdot.h:138
@ xop_pen_color
Definition xdot.h:134
@ xop_ellipse
Definition xdot.h:128
@ xop_polyline
Definition xdot.h:131
xdot_align
Definition xdot.h:76
@ xd_left
Definition xdot.h:76
@ xd_right
Definition xdot.h:76
@ xd_center
Definition xdot.h:76
void(* drawfunc_t)(xdot_op *, int)
Definition xdot.h:143
int statXDot(xdot *, xdot_stats *)
Definition xdot.c:778
void jsonXDot(FILE *, xdot *)
Definition xdot.c:716
char * sprintXDot(xdot *)
Definition xdot.c:706
xdot_kind
Definition xdot.h:108
@ xd_filled_polygon
Definition xdot.h:111
@ xd_pen_color
Definition xdot.h:118
@ xd_unfilled_ellipse
Definition xdot.h:110
@ xd_fontchar
Definition xdot.h:124
@ xd_font
Definition xdot.h:119
@ xd_fill_color
Definition xdot.h:117
@ xd_unfilled_bezier
Definition xdot.h:114
@ xd_grad_fill_color
Definition xdot.h:122
@ xd_polyline
Definition xdot.h:115
@ xd_text
Definition xdot.h:116
@ xd_filled_ellipse
Definition xdot.h:109
@ xd_image
Definition xdot.h:121
@ xd_unfilled_polygon
Definition xdot.h:112
@ xd_grad_pen_color
Definition xdot.h:123
@ xd_filled_bezier
Definition xdot.h:113
@ xd_style
Definition xdot.h:120
xdot * parseXDotFOn(char *, drawfunc_t opfns[], size_t sz, xdot *)
Definition xdot.c:340