| 1 | /* $Id$Revision: */ |
| 2 | /* vim:set shiftwidth=4 ts=8: */ |
| 3 | |
| 4 | /************************************************************************* |
| 5 | * Copyright (c) 2011 AT&T Intellectual Property |
| 6 | * All rights reserved. This program and the accompanying materials |
| 7 | * are made available under the terms of the Eclipse Public License v1.0 |
| 8 | * which accompanies this distribution, and is available at |
| 9 | * http://www.eclipse.org/legal/epl-v10.html |
| 10 | * |
| 11 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
| 12 | *************************************************************************/ |
| 13 | |
| 14 | #ifndef MAZE_H |
| 15 | #define MAZE_H |
| 16 | |
| 17 | #include <sgraph.h> |
| 18 | |
| 19 | enum {M_RIGHT=0, M_TOP, M_LEFT, M_BOTTOM}; |
| 20 | |
| 21 | #define MZ_ISNODE 1 |
| 22 | #define MZ_VSCAN 2 |
| 23 | #define MZ_HSCAN 4 |
| 24 | #define MZ_SMALLV 8 |
| 25 | #define MZ_SMALLH 16 |
| 26 | |
| 27 | /* cell corresponds to node */ |
| 28 | #define IsNode(cp) (cp->flags & MZ_ISNODE) |
| 29 | /* cell already inserted in vertical channel */ |
| 30 | #define IsVScan(cp) (cp->flags & MZ_VSCAN) |
| 31 | /* cell already inserted in horizontal channel */ |
| 32 | #define IsHScan(cp) (cp->flags & MZ_HSCAN) |
| 33 | /* cell has small height corresponding to a small height node */ |
| 34 | #define IsSmallV(cp) (cp->flags & MZ_SMALLV) |
| 35 | /* cell has small width corresponding to a small width node */ |
| 36 | #define IsSmallH(cp) (cp->flags & MZ_SMALLH) |
| 37 | |
| 38 | typedef struct cell { |
| 39 | int flags; |
| 40 | int nedges; |
| 41 | sedge* edges[6]; |
| 42 | int nsides; |
| 43 | snode** sides; |
| 44 | boxf bb; |
| 45 | } cell; |
| 46 | |
| 47 | typedef struct { |
| 48 | int ncells, ngcells; |
| 49 | cell* cells; /* cells not corresponding to graph nodes */ |
| 50 | cell* gcells; /* cells corresponding to graph nodes */ |
| 51 | sgraph* sg; |
| 52 | Dt_t* hchans; |
| 53 | Dt_t* vchans; |
| 54 | } maze; |
| 55 | |
| 56 | extern maze* mkMaze (graph_t*, int); |
| 57 | extern void freeMaze (maze*); |
| 58 | void updateWts (sgraph* g, cell* cp, sedge* ep); |
| 59 | #ifdef DEBUG |
| 60 | extern int odb_flags; |
| 61 | #define ODB_MAZE 1 |
| 62 | #define ODB_SGRAPH 2 |
| 63 | #define ODB_ROUTE 4 |
| 64 | #define ODB_CHANG 8 |
| 65 | #define ODB_IGRAPH 16 |
| 66 | #endif |
| 67 | #endif |
| 68 | |