Graphviz 15.1.1~dev.20260625.0932
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 v2.0
10 * which accompanies this distribution, and is available at
11 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.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 <stdio.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 const char AgDataRecName[];
58
59 /* set ordering disciplines */
67
68 /* internal constructor of graphs and subgraphs */
70int agstrclose(Agraph_t * g);
71
73enum { SEQ_MASK = (1 << (sizeof(unsigned) * 8 - 4)) - 1 };
74
75 /* object set management */
77uint64_t agnextseq(Agraph_t * g, int objtype);
78
79/* dict helper functions */
81void agdtdisc(Dict_t * dict, Dtdisc_t * disc);
82int agdtclose(Dict_t * dict);
83
87 /* name-value pair operations */
88CGHDR_API Agdatadict_t *agdatadict(Agraph_t *g, bool cflag);
89CGHDR_API Agattr_t *agattrrec(void *obj);
90
98
99 /* parsing and lexing graph files
100 *
101 * aagscan_t is opaque, because it is generated
102 * by flex based on scan.l.
103 * See https://westes.github.io/flex/manual/About-yyscan_005ft.html
104 */
105typedef void *aagscan_t;
106typedef struct aagextra_s aagextra_t;
107
111void aagset_in(FILE *, aagscan_t);
112
114void aglexeof(aagscan_t yyscanner);
115void aglexbad(aagscan_t yyscanner);
116
117 /* ID management */
118int agmapnametoid(Agraph_t *g, int objtype, char *str, IDTYPE *result,
119 bool createflag);
120void agfreeid(Agraph_t * g, int objtype, IDTYPE id);
121char *agprintid(Agobj_t * obj);
122bool aginternalmaplookup(Agraph_t *g, int objtype, char *str, IDTYPE *result);
123void aginternalmapinsert(Agraph_t * g, int objtype, char *str,
124 IDTYPE result);
125char *aginternalmapprint(Agraph_t * g, int objtype, IDTYPE id);
126int aginternalmapdelete(Agraph_t * g, int objtype, IDTYPE id);
128void agregister(Agraph_t * g, int objtype, void *obj);
129
130 /* internal set operations */
131void agedgesetop(Agraph_t * g, Agedge_t * e, int insertion);
132void agdelnodeimage(Agraph_t *g, Agobj_t *node, void *ignored);
133void agdeledgeimage(Agraph_t *g, Agobj_t *edge, void *ignored);
139CGHDR_API int agrename(Agobj_t * obj, char *newname);
140void agrecclose(Agobj_t * obj);
141
144void agmethod_init(Agraph_t * g, void *obj);
145void agmethod_upd(Agraph_t * g, void *obj, Agsym_t * sym);
146void agmethod_delete(Agraph_t * g, void *obj);
147
148void aginitcb(Agraph_t * g, void *obj, Agcbstack_t * disc);
149void agupdcb(Agraph_t * g, void *obj, Agsym_t * sym, Agcbstack_t * disc);
150void agdelcb(Agraph_t * g, void *obj, Agcbstack_t * disc);
152
157
166CGHDR_API size_t agnnodes_z(const Agraph_t *g);
void agfreeid(Agraph_t *g, int objtype, IDTYPE id)
Definition id.c:133
int aagparse(aagscan_t scanner)
int agstrclose(Agraph_t *g)
Definition refstr.c:326
void aginternalmapclose(Agraph_t *g)
Definition imap.c:197
const char AgDataRecName[]
Definition attr.c:156
int aaglex_destroy(aagscan_t)
void agrecclose(Agobj_t *obj)
Definition rec.c:229
Agnode_t * agfindnode_by_id(Agraph_t *g, IDTYPE id)
Definition node.c:25
int aginternalmapdelete(Agraph_t *g, int objtype, IDTYPE id)
Definition imap.c:151
int agapply(Agraph_t *g, Agobj_t *obj, agobjfn_t fn, void *arg, int preorder)
Definition apply.c:62
void agdelnodeimage(Agraph_t *g, Agobj_t *node, void *ignored)
Definition node.c:175
void aginternalmapinsert(Agraph_t *g, int objtype, char *str, IDTYPE result)
Definition imap.c:105
Dtdisc_t Ag_subnode_seq_disc
Definition node.c:306
void aagset_in(FILE *, aagscan_t)
int agmapnametoid(Agraph_t *g, int objtype, char *str, IDTYPE *result, bool createflag)
Definition id.c:104
Agraph_t * agopen1(Agraph_t *g)
Definition graph.c:68
void aglexeof(aagscan_t yyscanner)
Definition scan.l:191
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:141
int agdtclose(Dict_t *dict)
Definition utils.c:25
Dtdisc_t Ag_subedge_seq_disc
Definition edge.c:410
uint64_t agnextseq(Agraph_t *g, int objtype)
Definition graph.c:152
int aaglex_init_extra(aagextra_t *user_defined, aagscan_t *scanner)
bool aginternalmaplookup(Agraph_t *g, int objtype, char *str, IDTYPE *result)
Definition imap.c:84
Dtdisc_t Ag_mainedge_seq_disc
Definition edge.c:405
void agregister(Agraph_t *g, int objtype, void *obj)
Definition id.c:172
int agrename(Agobj_t *obj, char *newname)
Definition obj.c:43
@ SEQ_MASK
Definition cghdr.h:73
void aglexbad(aagscan_t yyscanner)
Definition scan.l:196
Dtdisc_t Ag_subedge_id_disc
Definition edge.c:421
void agdtdisc(Dict_t *dict, Dtdisc_t *disc)
Definition utils.c:32
aagextra_t * aagget_extra(aagscan_t yyscanner)
void agdeledgeimage(Agraph_t *g, Agobj_t *edge, void *ignored)
Definition edge.c:299
Dtdisc_t Ag_mainedge_id_disc
Definition edge.c:416
char * agprintid(Agobj_t *obj)
size_t agnnodes_z(const Agraph_t *g)
Definition graph.c:157
Dtdisc_t Ag_subgraph_seq_disc
Definition graph.c:264
Dtdisc_t Ag_subgraph_id_disc
Definition graph.c:269
void * aagscan_t
Definition cghdr.h:105
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:246
void aginternalmapclearlocalnames(Agraph_t *g)
Definition imap.c:167
Agattr_t * agattrrec(void *obj)
Definition attr.c:205
void agnodeattr_init(Agraph_t *g, Agnode_t *n)
Definition attr.c:409
void agnodeattr_delete(Agnode_t *n)
Definition attr.c:418
void agedgeattr_init(Agraph_t *g, Agedge_t *e)
Definition attr.c:428
void agraphattr_init(Agraph_t *g)
Definition attr.c:379
void agedgeattr_delete(Agedge_t *e)
Definition attr.c:437
Agdatadict_t * agdatadict(Agraph_t *g, bool cflag)
Definition attr.c:49
int agraphattr_delete(Agraph_t *g)
Definition attr.c:390
void agupdcb(Agraph_t *g, void *obj, Agsym_t *sym, Agcbstack_t *disc)
Definition obj.c:115
void agdelcb(Agraph_t *g, void *obj, Agcbstack_t *disc)
Definition obj.c:145
void aginitcb(Agraph_t *g, void *obj, Agcbstack_t *disc)
Definition obj.c:85
void agmethod_delete(Agraph_t *g, void *obj)
Definition obj.c:140
void agmethod_init(Agraph_t *g, void *obj)
Definition obj.c:80
void agmethod_upd(Agraph_t *g, void *obj, Agsym_t *sym)
Definition obj.c:110
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:218
cleanup & scanner
Definition htmlparse.y:289
string attribute container
Definition cgraph.h:632
object event callbacks
Definition cgraph.h:398
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:640
Definition cdt.h:98