2 ase-digraph.h -- Directed 2-ary Graphs
3 Copyright (C) 2006, 2007 Sebastian Freundt
5 Author: Sebastian Freundt <hroptatyr@sxemacs.org>
7 * This file is part of SXEmacs.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the author nor the names of any contributors
21 * may be used to endorse or promote products derived from this
22 * software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
25 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 /* Synched up with: Not in FSF. */
39 #ifndef INCLUDED_ase_digraph_h_
40 #define INCLUDED_ase_digraph_h_ 1
45 typedef struct ase_digraph_s *ase_digraph_t;
47 extern Lisp_Object Qase_digraph, Qase_digraphp;
49 extern void LTX_PUBINIT(ase_digraph)(void);
50 extern void LTX_PUBREINIT(ase_digraph)(void);
51 extern void LTX_PUBDEINIT(ase_digraph)(void);
54 struct ase_digraph_s {
60 int auto_remove_nodes;
64 #define ASE_DIGRAPHP(_i) \
65 (DYNACATP(_i) && EQ(XDYNACAT(_i)->type, Qase_digraph))
66 #define CHECK_ASE_DIGRAPH(x) \
68 if (!ASE_DIGRAPHP(x)) \
69 dead_wrong_type_argument(Qase_digraphp, x); \
71 #define CONCHECK_ASE_DIGRAPH(x) \
73 if (!ASE_DIGRAPHP(x)) \
74 x = wrong_type_argument(Qase_digraphp, x); \
76 #define XSETASE_DIGRAPH(_res, _int) (_res) = _ase_wrap_digraph((_int))
77 #define XASE_DIGRAPH(_x) ((ase_digraph_t)get_dynacat(_x))
79 #define ase_digraph_nodes(_x) (_x)->edges
80 #define ase_digraph_edges(_x) (_x)->edges
81 #define ase_digraph_redges(_x) (_x)->redges
83 extern Lisp_Object _ase_wrap_digraph(ase_digraph_t a);
84 extern Lisp_Object ase_make_digraph(void);
85 extern Lisp_Object ase_digraph_add_node(ase_digraph_t, Lisp_Object);
86 extern void ase_digraph_add_edge_aa(ase_digraph_t, Lisp_Object, Lisp_Object);
87 extern void ase_digraph_add_edge(ase_digraph_t, Lisp_Object, Lisp_Object);
88 extern void ase_digraph_remove_edge_ar(ase_digraph_t, Lisp_Object, Lisp_Object);
89 extern void ase_digraph_remove_edge(ase_digraph_t, Lisp_Object, Lisp_Object);
90 extern int ase_digraph_has_edge_p(ase_digraph_t, Lisp_Object, Lisp_Object);
93 #endif /* INCLUDED_ase_digraph_h_ */