| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#ifdef __cplusplus |
| 14 |
extern "C" { |
| 15 |
#endif |
| 16 |
|
| 17 |
#include <circogen/nodelist.h> |
| 18 |
|
| 19 |
typedef struct block block_t; |
| 20 |
|
| 21 |
typedef struct { |
| 22 |
block_t *first; |
| 23 |
block_t *last; |
| 24 |
} blocklist_t; |
| 25 |
|
| 26 |
struct block { |
| 27 |
Agnode_t *child; /* if non-null, points to node in parent block */ |
| 28 |
block_t *next; /* sibling block */ |
| 29 |
Agraph_t *sub_graph; /* nodes and edges in this block */ |
| 30 |
double radius; /* radius of block and subblocks */ |
| 31 |
double rad0; /* radius of block */ |
| 32 |
nodelist_t circle_list; /* ordered list of nodes in block */ |
| 33 |
blocklist_t children; /* child blocks */ |
| 34 |
double parent_pos; /* if block has 1 node, angle to place parent */ |
| 35 |
int flags; |
| 36 |
}; |
| 37 |
|
| 38 |
extern block_t *mkBlock(Agraph_t *); |
| 39 |
extern void freeBlock(block_t * sp); |
| 40 |
extern int blockSize(block_t * sp); |
| 41 |
|
| 42 |
extern void initBlocklist(blocklist_t *); |
| 43 |
extern void appendBlock(blocklist_t * sp, block_t * sn); |
| 44 |
extern void insertBlock(blocklist_t * sp, block_t * sn); |
| 45 |
|
| 46 |
#ifdef DEBUG |
| 47 |
extern void printBlocklist(blocklist_t * snl); |
| 48 |
#endif |
| 49 |
|
| 50 |
#define CHILD(b) ((b)->child) |
| 51 |
#define BLK_PARENT(b) (CHILD(b)? PARENT(CHILD(b)) : 0) |
| 52 |
#define BLK_FLAGS(b) ((b)->flags) |
| 53 |
|
| 54 |
#define COALESCED_F (1 << 0) |
| 55 |
#define COALESCED(b) (BLK_FLAGS(b)&COALESCED_F) |
| 56 |
#define SET_COALESCED(b) (BLK_FLAGS(b) |= COALESCED_F) |
| 57 |
|
| 58 |
#ifdef __cplusplus |
| 59 |
} |
| 60 |
#endif |