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