Graphviz 2.29.20120208.0545
lib/circogen/block.h
Go to the documentation of this file.
00001 /* $Id$ $Revision$ */
00002 /* vim:set shiftwidth=4 ts=8: */
00003 
00004 /*************************************************************************
00005  * Copyright (c) 2011 AT&T Intellectual Property 
00006  * All rights reserved. This program and the accompanying materials
00007  * are made available under the terms of the Eclipse Public License v1.0
00008  * which accompanies this distribution, and is available at
00009  * http://www.eclipse.org/legal/epl-v10.html
00010  *
00011  * Contributors: See CVS logs. Details at http://www.graphviz.org/
00012  *************************************************************************/
00013 
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017 
00018 #ifndef BLOCK_H
00019 #define BLOCK_H
00020 
00021 #include  <nodelist.h>
00022 
00023     typedef struct block block_t;
00024 
00025     typedef struct {
00026         block_t *first;
00027         block_t *last;
00028     } blocklist_t;
00029 
00030     struct block {
00031         Agnode_t *child;        /* if non-null, points to node in parent block */
00032         block_t *next;          /* sibling block */
00033         Agraph_t *sub_graph;    /* nodes and edges in this block */
00034         double radius;          /* radius of block and subblocks */
00035         double rad0;            /* radius of block */
00036         nodelist_t *circle_list;        /* ordered list of nodes in block */
00037         blocklist_t children;   /* child blocks */
00038         double parent_pos;      /* if block has 1 node, angle to place parent */
00039         int flags;
00040     };
00041 
00042     extern block_t *mkBlock(Agraph_t *);
00043     extern void freeBlock(block_t * sp);
00044     extern int blockSize(block_t * sp);
00045 
00046     extern void initBlocklist(blocklist_t *);
00047     extern void appendBlock(blocklist_t * sp, block_t * sn);
00048     extern void insertBlock(blocklist_t * sp, block_t * sn);
00049 /* extern void freeBlocklist (blocklist_t* sp); */
00050 
00051 #ifdef DEBUG
00052     extern void printBlocklist(blocklist_t * snl);
00053 #endif
00054 
00055 #define CHILD(b) ((b)->child)
00056 #define BLK_PARENT(b) (CHILD(b)? PARENT(CHILD(b)) : 0)
00057 #define BLK_FLAGS(b) ((b)->flags)
00058 
00059 #define COALESCED_F   (1 << 0)
00060 #define COALESCED(b) (BLK_FLAGS(b)&COALESCED_F)
00061 #define SET_COALESCED(b) (BLK_FLAGS(b) |= COALESCED_F)
00062 
00063 #endif
00064 
00065 #ifdef __cplusplus
00066 }
00067 #endif