| 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 INGRAPHS_H |
| 15 | #define INGRAPHS_H |
| 16 | |
| 17 | /* The ingraphs library works with both libagraph and with |
| 18 | * libgraph, with all user-supplied data. For this to work, |
| 19 | * the include file relies upon its context to supply a |
| 20 | * definition of Agraph_t. |
| 21 | */ |
| 22 | |
| 23 | #include <stdio.h> |
| 24 | |
| 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | |
| 29 | typedef Agraph_t *(*opengfn) (FILE *); |
| 30 | |
| 31 | typedef struct { |
| 32 | void *(*openf) (char *); |
| 33 | Agraph_t *(*readf) (void *); |
| 34 | int (*closef) (void *); |
| 35 | void *dflt; |
| 36 | } ingdisc; |
| 37 | |
| 38 | typedef struct { |
| 39 | union { |
| 40 | char** Files; |
| 41 | Agraph_t** Graphs; |
| 42 | } u; |
| 43 | int ctr; |
| 44 | int ingraphs; |
| 45 | void *fp; |
| 46 | ingdisc *fns; |
| 47 | char heap; |
| 48 | int errors; |
| 49 | } ingraph_state; |
| 50 | |
| 51 | extern ingraph_state *newIngraph(ingraph_state *, char **, opengfn); |
| 52 | extern ingraph_state *newIng(ingraph_state *, char **, ingdisc *); |
| 53 | extern ingraph_state *newIngGraphs(ingraph_state *, Agraph_t**, ingdisc *); |
| 54 | extern void closeIngraph(ingraph_state * sp); |
| 55 | extern Agraph_t *nextGraph(ingraph_state *); |
| 56 | extern char *fileName(ingraph_state *); |
| 57 | |
| 58 | #ifdef __cplusplus |
| 59 | } |
| 60 | #endif |
| 61 | #endif |
| 62 | |