Graphviz 13.0.0~dev.20250121.0651
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 <ctype.h>
35#include <sys/types.h>
36#include <stdarg.h>
37#include <stdbool.h>
38#include <stdlib.h>
39#include <string.h>
40#include <assert.h>
41#include <stdint.h>
42#include <util/list.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
74enum { SEQ_MASK = (1 << (sizeof(unsigned) * 8 - 4)) - 1 };
75
76 /* object set management */
78uint64_t agnextseq(Agraph_t * g, int objtype);
79
80/* dict helper functions */
82void agdtdisc(Agraph_t * g, Dict_t * dict, Dtdisc_t * disc);
83int agdtdelete(Agraph_t * g, Dict_t * dict, void *obj);
84int agdtclose(Agraph_t * g, Dict_t * dict);
85
89 /* name-value pair operations */
90CGHDR_API Agdatadict_t *agdatadict(Agraph_t *g, bool cflag);
91CGHDR_API Agattr_t *agattrrec(void *obj);
92
100
101 /* parsing and lexing graph files
102 *
103 * aagscan_t is opaque, because it is generated
104 * by flex based on scan.l.
105 * See https://westes.github.io/flex/manual/About-yyscan_005ft.html
106 */
107typedef void *aagscan_t;
108typedef struct aagextra_s aagextra_t;
109
110int aagparse(void);
111void aglexinit(Agdisc_t * disc, void *ifile);
112int aaglex(void);
113void aglexeof(void);
114void aglexbad(void);
115
116 /* ID management */
117int agmapnametoid(Agraph_t *g, int objtype, char *str, IDTYPE *result,
118 bool createflag);
119void agfreeid(Agraph_t * g, int objtype, IDTYPE id);
120char *agprintid(Agobj_t * obj);
121bool aginternalmaplookup(Agraph_t *g, int objtype, char *str, IDTYPE *result);
122void aginternalmapinsert(Agraph_t * g, int objtype, char *str,
123 IDTYPE result);
124char *aginternalmapprint(Agraph_t * g, int objtype, IDTYPE id);
125int aginternalmapdelete(Agraph_t * g, int objtype, IDTYPE id);
127void agregister(Agraph_t * g, int objtype, void *obj);
128
129 /* internal set operations */
130void agedgesetop(Agraph_t * g, Agedge_t * e, int insertion);
131void agdelnodeimage(Agraph_t * g, Agnode_t * node, void *ignored);
132void agdeledgeimage(Agraph_t * g, Agedge_t * edge, void *ignored);
138CGHDR_API int agrename(Agobj_t * obj, char *newname);
139void agrecclose(Agobj_t * obj);
140
143void agmethod_init(Agraph_t * g, void *obj);
144void agmethod_upd(Agraph_t * g, void *obj, Agsym_t * sym);
145void agmethod_delete(Agraph_t * g, void *obj);
146
147void aginitcb(Agraph_t * g, void *obj, Agcbstack_t * disc);
148void agupdcb(Agraph_t * g, void *obj, Agsym_t * sym, Agcbstack_t * disc);
149void agdelcb(Agraph_t * g, void *obj, Agcbstack_t * disc);
151
152DEFINE_LIST(Agraphs, Agraph_t *)
void agfreeid(Agraph_t *g, int objtype, IDTYPE id)
Definition id.c:131
int agstrclose(Agraph_t *g)
Definition refstr.c:322
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:41
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:173
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:306
int agmapnametoid(Agraph_t *g, int objtype, char *str, IDTYPE *result, bool createflag)
Definition id.c:102
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:300
Dict_t * agdtopen(Dtdisc_t *disc, Dtmethod_t *method)
Definition utils.c:21
char * aginternalmapprint(Agraph_t *g, int objtype, IDTYPE id)
Definition imap.c:139
int agdtdelete(Agraph_t *g, Dict_t *dict, void *obj)
Definition utils.c:25
Dtdisc_t Ag_subedge_seq_disc
Definition edge.c:411
Agraph_t * Ag_G_global
Definition graph.c:24
uint64_t agnextseq(Agraph_t *g, int objtype)
Definition graph.c:160
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:406
void agregister(Agraph_t *g, int objtype, void *obj)
Definition id.c:170
int agrename(Agobj_t *obj, char *newname)
Definition obj.c:41
void agdelnodeimage(Agraph_t *g, Agnode_t *node, void *ignored)
Definition node.c:172
int aagparse(void)
Dtdisc_t Ag_subedge_id_disc
Definition edge.c:422
Dtdisc_t Ag_mainedge_id_disc
Definition edge.c:417
char * agprintid(Agobj_t *obj)
void aglexeof(void)
Definition scan.c:2400
Dtdisc_t Ag_subgraph_seq_disc
Definition graph.c:270
Dtdisc_t Ag_subgraph_id_disc
Definition graph.c:275
@ SEQ_MASK
Definition cghdr.h:74
void * aagscan_t
Definition cghdr.h:107
int agdtclose(Agraph_t *g, Dict_t *dict)
Definition utils.c:31
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:236
void agnodeattr_init(Agraph_t *g, Agnode_t *n)
Definition attr.c:427
void agnodeattr_delete(Agnode_t *n)
Definition attr.c:436
void agedgeattr_init(Agraph_t *g, Agedge_t *e)
Definition attr.c:446
void agraphattr_init(Agraph_t *g)
Definition attr.c:396
void agedgeattr_delete(Agedge_t *e)
Definition attr.c:455
Agdatadict_t * agdatadict(Agraph_t *g, bool cflag)
Definition attr.c:49
int agraphattr_delete(Agraph_t *g)
Definition attr.c:407
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:368
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:21
string attribute container
Definition cgraph.h:633
object event callbacks
Definition cgraph.h:398
user's discipline
Definition cgraph.h:336
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
graph or subgraph
Definition cgraph.h:424
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:641
Definition cdt.h:100