Build Fix -- compatibility issue with newer autoconf
[sxemacs] / src / ent / ent-unary-rel.h
1 /*
2   ent-unary-rel.h -- Global Unary Relations
3   Copyright (C) 2006, 2007, 2008 Sebastian Freundt
4
5   Author:  Sebastian Freundt <hroptatyr@sxemacs.org>
6
7   * This file is part of SXEmacs.
8   *
9   * Redistribution and use in source and binary forms, with or without
10   * modification, are permitted provided that the following conditions
11   * are met:
12   *
13   * 1. Redistributions of source code must retain the above copyright
14   *    notice, this list of conditions and the following disclaimer.
15   *
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.
19   *
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.
23   *
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.
35   */
36
37 /* Synched up with: Not in FSF. */
38
39 #ifndef INCLUDED_ent_unary_rel_h_
40 #define INCLUDED_ent_unary_rel_h_
41
42 #define ENT_DEBUG_UNREL(args...)        ENT_DEBUG("[UNREL]: " args)
43
44 /*************************/
45 /* new ASE optable magic */
46 /*************************/
47 /* the unary reltable */
48 typedef enum ase_unary_relation_e ase_unary_relation_t;
49 typedef int(*ase_unary_relation_f)(Lisp_Object);
50
51 enum ase_unary_relation_e {
52         ASE_UNARY_REL_ZEROP,
53         ASE_UNARY_FIRST_REL = ASE_UNARY_REL_ZEROP,
54         ASE_UNARY_REL_ONEP,
55         ASE_UNARY_REL_UNITP,
56         ASE_UNARY_LAST_REL = ASE_UNARY_REL_UNITP,
57         N_ASE_UNARY_RELS
58 };
59
60 extern ase_unary_relation_f
61 ase_unary_reltable[N_ASE_UNARY_RELS][ASE_OPTABLE_SIZE];
62
63 extern int ase_unary_relation_undefined(Lisp_Object l);
64
65 extern_inline void
66 ent_unrel_register(
67         ase_unary_relation_t rel,
68         ase_object_type_t t, ase_unary_relation_f relf);
69 extern_inline void
70 ent_unrel_unregister(ase_unary_relation_t rel, ase_object_type_t t);
71 extern_inline int
72 _ent_unrel(ase_unary_relation_t rel, ase_object_type_t lt, Lisp_Object l);
73 extern_inline int
74 ent_unrel(ase_unary_relation_t rel, Lisp_Object l);
75
76 \f
77 extern_inline void
78 ent_unrel_register(ase_unary_relation_t rel,
79                    ase_object_type_t t, ase_unary_relation_f relf)
80 {
81         ase_unary_reltable[rel][t] = relf;
82         return;
83 }
84 extern_inline void
85 ent_unrel_unregister(ase_unary_relation_t rel, ase_object_type_t t)
86 {
87         ase_unary_reltable[rel][t] = ase_unary_relation_undefined;
88         return;
89 }
90
91 extern void ase_unary_reltable_init(void);
92
93 extern_inline int
94 _ent_unrel(ase_unary_relation_t rel, ase_object_type_t lt, Lisp_Object l)
95 {
96         ase_unary_relation_f relf =
97                 ase_unary_reltable[rel][lt];
98
99         return relf(l);
100 }
101 extern_inline int
102 ent_unrel(ase_unary_relation_t rel, Lisp_Object l)
103 {
104         ase_object_type_t lt = ase_optable_index(l);
105
106         return _ent_unrel(rel, lt, l);
107 }
108
109 #define _ent_unrel_zerop(_t, _o)        _ent_unrel(ASE_UNARY_REL_ZEROP, _t, _o)
110 #define ent_unrel_zerop(_o)             ent_unrel(ASE_UNARY_REL_ZEROP, _o)
111 #define _ent_unrel_onep(_t, _o)         _ent_unrel(ASE_UNARY_REL_ONEP, _t, _o)
112 #define ent_unrel_onep(_o)              ent_unrel(ASE_UNARY_REL_ONEP, _o)
113 #define _ent_unrel_unitp(_t, _o)        _ent_unrel(ASE_UNARY_REL_UNITP, _t, _o)
114 #define ent_unrel_unitp(_o)             ent_unrel(ASE_UNARY_REL_UNITP, _o)
115
116 EXFUN(Fzerop, 1);
117 EXFUN(Fonep, 1);
118 EXFUN(Funitp, 1);
119
120 extern void syms_of_ent_unary_rel(void);
121 extern void vars_of_ent_unary_rel(void);
122
123 #endif  /* INCLUDED_ent_unary_rel_h_ */