Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
cghdr.h
Go to the documentation of this file.
1
6/*************************************************************************
7 * Copyright (c) 2011 AT&T Intellectual Property
8 * All rights reserved. This program and the accompanying materials
9 * are made available under the terms of the Eclipse Public License v1.0
10 * which accompanies this distribution, and is available at
11 * https://www.eclipse.org/legal/epl-v10.html
12 *
13 * Contributors: Details at https://graphviz.org
14 *************************************************************************/
15
16#pragma once
17
18#include "config.h"
19
20#ifdef GVDLL
21#ifdef EXPORT_CGHDR
22#define CGHDR_API __declspec(dllexport)
23#else
24#define CGHDR_API __declspec(dllimport)
25#endif
26#endif
27
28#ifndef CGHDR_API
29#define CGHDR_API /* nothing */
30#endif
31
32#include <cgraph.h>
33
34#include <cgraph/list.h>
35#include <ctype.h>
36#include <sys/types.h>
37#include <stdarg.h>
38#include <stdbool.h>
39#include <stdlib.h>
40#include <string.h>
41#include <assert.h>
42#include <stdint.h>
43
44#define SUCCESS 0
45#define FAILURE -1
46#define LOCALNAMEPREFIX '%'
47
48#define AGDISC(g,d) ((g)->clos->disc.d)
49#define AGCLOS(g,d) ((g)->clos->state.d)
50
51 /* functional definitions */
52typedef Agobj_t *(*agobjsearchfn_t) (Agraph_t * g, Agobj_t * obj);
53CGHDR_API int agapply(Agraph_t * g, Agobj_t * obj, agobjfn_t fn, void *arg,
54 int preorder);
55
56 /* global variables */
57extern Agraph_t *Ag_G_global;
58extern char *AgDataRecName;
59
60 /* set ordering disciplines */
68
69 /* internal constructor of graphs and subgraphs */
71int agstrclose(Agraph_t * g);
72
73 /* ref string management */
74void agmarkhtmlstr(char *s);
75
77enum { SEQ_MASK = (1 << (sizeof(unsigned) * 8 - 4)) - 1 };
78
79 /* object set management */
81uint64_t agnextseq(Agraph_t * g, int objtype);
82
83/* dict helper functions */
85void agdtdisc(Agraph_t * g, Dict_t * dict, Dtdisc_t * disc);
86int agdtdelete(Agraph_t * g, Dict_t * dict, void *obj);
87int agdtclose(Agraph_t * g, Dict_t * dict);
88
92 /* name-value pair operations */
93CGHDR_API Agdatadict_t *agdatadict(Agraph_t *g, bool cflag);
94CGHDR_API Agattr_t *agattrrec(void *obj);
95
100void agedgeattr_init(Agraph_t *g, Agedge_t * e);
103
104 /* parsing and lexing graph files
105 *
106 * aagscan_t is opaque, because it is generated
107 * by flex based on scan.l.
108 * See https://westes.github.io/flex/manual/About-yyscan_005ft.html
109 */
110typedef void *aagscan_t;
111typedef struct aagextra_s aagextra_t;
112
113int aagparse(void);
114void aglexinit(Agdisc_t * disc, void *ifile);
115int aaglex(void);
116void aglexeof(void);
117void aglexbad(void);
118
119 /* ID management */
120int agmapnametoid(Agraph_t *g, int objtype, char *str, IDTYPE *result,
121 bool createflag);
122int agallocid(Agraph_t * g, int objtype, IDTYPE request);
123void agfreeid(Agraph_t * g, int objtype, IDTYPE id);
124char *agprintid(Agobj_t * obj);
125bool aginternalmaplookup(Agraph_t *g, int objtype, char *str, IDTYPE *result);
126void aginternalmapinsert(Agraph_t * g, int objtype, char *str,
127 IDTYPE result);
128char *aginternalmapprint(Agraph_t * g, int objtype, IDTYPE id);
129int aginternalmapdelete(Agraph_t * g, int objtype, IDTYPE id);
131void agregister(Agraph_t * g, int objtype, void *obj);
132
133 /* internal set operations */
134void agedgesetop(Agraph_t * g, Agedge_t * e, int insertion);
135void agdelnodeimage(Agraph_t * g, Agnode_t * node, void *ignored);
136void agdeledgeimage(Agraph_t * g, Agedge_t * edge, void *ignored);
142CGHDR_API int agrename(Agobj_t * obj, char *newname);
143void agrecclose(Agobj_t * obj);
144
147void agmethod_init(Agraph_t * g, void *obj);
148void agmethod_upd(Agraph_t * g, void *obj, Agsym_t * sym);
149void agmethod_delete(Agraph_t * g, void *obj);
150
151void aginitcb(Agraph_t * g, void *obj, Agcbstack_t * disc);
152void agupdcb(Agraph_t * g, void *obj, Agsym_t * sym, Agcbstack_t * disc);
153void agdelcb(Agraph_t * g, void *obj, Agcbstack_t * disc);
155
156DEFINE_LIST(Agraphs, Agraph_t *)
157
158
177typedef struct {
179 Agraphs_t linear;
180} g_seq_t;
181
188static inline Agraphs_t *g_seq2(Agraph_t *g) {
189 g_seq_t *seq = (g_seq_t *)g->g_seq;
190 return &seq->linear;
191}
void agfreeid(Agraph_t *g, int objtype, IDTYPE id)
Definition id.c:146
int agstrclose(Agraph_t *g)
Definition refstr.c:64
void aginternalmapclose(Agraph_t *g)
Definition imap.c:196
void aglexbad(void)
Definition scan.c:2402
void agdtdisc(Agraph_t *g, Dict_t *dict, Dtdisc_t *disc)
Definition utils.c:42
void agrecclose(Agobj_t *obj)
Definition rec.c:227
Agnode_t * agfindnode_by_id(Agraph_t *g, IDTYPE id)
Definition node.c:22
char * AgDataRecName
Definition attr.c:171
int aginternalmapdelete(Agraph_t *g, int objtype, IDTYPE id)
Definition imap.c:149
int agapply(Agraph_t *g, Agobj_t *obj, agobjfn_t fn, void *arg, int preorder)
Definition apply.c:60
void aginternalmapinsert(Agraph_t *g, int objtype, char *str, IDTYPE result)
Definition imap.c:103
Dtdisc_t Ag_subnode_seq_disc
Definition node.c:311
int agmapnametoid(Agraph_t *g, int objtype, char *str, IDTYPE *result, bool createflag)
Definition id.c:112
void aglexinit(Agdisc_t *disc, void *ifile)
Definition scan.c:2421
Agraph_t * agopen1(Agraph_t *g)
Definition graph.c:68
void agdeledgeimage(Agraph_t *g, Agedge_t *edge, void *ignored)
Definition edge.c:304
Dict_t * agdtopen(Agraph_t *g, Dtdisc_t *disc, Dtmethod_t *method)
Definition utils.c:21
static Agraphs_t * g_seq2(Agraph_t *g)
Definition cghdr.h:188
char * aginternalmapprint(Agraph_t *g, int objtype, IDTYPE id)
Definition imap.c:139
int agallocid(Agraph_t *g, int objtype, IDTYPE request)
Definition id.c:141
int agdtdelete(Agraph_t *g, Dict_t *dict, void *obj)
Definition utils.c:26
Dtdisc_t Ag_subedge_seq_disc
Definition edge.c:415
Agraph_t * Ag_G_global
Definition graph.c:24
uint64_t agnextseq(Agraph_t *g, int objtype)
Definition graph.c:164
void agmarkhtmlstr(char *s)
Definition refstr.c:174
bool aginternalmaplookup(Agraph_t *g, int objtype, char *str, IDTYPE *result)
Definition imap.c:82
int aaglex(void)
Dtdisc_t Ag_mainedge_seq_disc
Definition edge.c:410
void agregister(Agraph_t *g, int objtype, void *obj)
Definition id.c:185
int agrename(Agobj_t *obj, char *newname)
Definition obj.c:41
void agdelnodeimage(Agraph_t *g, Agnode_t *node, void *ignored)
Definition node.c:177
int aagparse(void)
Dtdisc_t Ag_subedge_id_disc
Definition edge.c:426
Dtdisc_t Ag_mainedge_id_disc
Definition edge.c:421
char * agprintid(Agobj_t *obj)
void aglexeof(void)
Definition scan.c:2400
Dtdisc_t Ag_subgraph_seq_disc
Definition graph.c:274
Dtdisc_t Ag_subgraph_id_disc
Definition graph.c:279
@ SEQ_MASK
Definition cghdr.h:77
void * aagscan_t
Definition cghdr.h:110
int agdtclose(Agraph_t *g, Dict_t *dict)
Definition utils.c:32
void agedgesetop(Agraph_t *g, Agedge_t *e, int insertion)
abstract graph C library, Cgraph API
static Dtdisc_t disc
Definition exparse.y:209
edge
Definition gmlparse.y:240
Agattr_t * agattrrec(void *obj)
Definition attr.c:229
void agnodeattr_init(Agraph_t *g, Agnode_t *n)
Definition attr.c:401
void agnodeattr_delete(Agnode_t *n)
Definition attr.c:410
void agedgeattr_init(Agraph_t *g, Agedge_t *e)
Definition attr.c:420
void agraphattr_init(Agraph_t *g)
Definition attr.c:370
void agedgeattr_delete(Agedge_t *e)
Definition attr.c:429
Agdatadict_t * agdatadict(Agraph_t *g, bool cflag)
Definition attr.c:49
int agraphattr_delete(Agraph_t *g)
Definition attr.c:381
void agupdcb(Agraph_t *g, void *obj, Agsym_t *sym, Agcbstack_t *disc)
Definition obj.c:113
void agdelcb(Agraph_t *g, void *obj, Agcbstack_t *disc)
Definition obj.c:143
void aginitcb(Agraph_t *g, void *obj, Agcbstack_t *disc)
Definition obj.c:83
void agmethod_delete(Agraph_t *g, void *obj)
Definition obj.c:138
void agmethod_init(Agraph_t *g, void *obj)
Definition obj.c:78
void agmethod_upd(Agraph_t *g, void *obj, Agsym_t *sym)
Definition obj.c:108
void(* agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg)
Definition cgraph.h:369
uint64_t IDTYPE
unique per main graph ID
Definition cgraph.h:73
textitem scanner parser str
Definition htmlparse.y:224
#define DEFINE_LIST(name, type)
Definition list.h:26
string attribute container
Definition cgraph.h:629
object event callbacks
Definition cgraph.h:399
user's discipline
Definition cgraph.h:337
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
graph or subgraph
Definition cgraph.h:425
Dict_t * g_seq
Definition cgraph.h:433
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:637
Definition cdt.h:100
Agraphs_t linear
the newer contiguous collection
Definition cghdr.h:179
Dt_t legacy
the traditional tree of subgraphs
Definition cghdr.h:178
Definition grammar.c:93