Build Fix -- compatibility issue with newer autoconf
[sxemacs] / src / ent / ent-lift.h
1 /*
2   ent-lift.h -- Global Lifting
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_lift_h_
40 #define INCLUDED_ent_lift_h_
41
42 #define ENT_DEBUG_LIFT(args...)         ENT_DEBUG("[LIFT]: " args)
43
44 /*************************/
45 /* new ASE optable magic */
46 /*************************/
47 /* the lift table */
48 typedef struct ent_lift_args_s *ent_lift_args_t;
49 typedef Lisp_Object(*ase_lift_f)(Lisp_Object, ent_lift_args_t);
50
51 struct ent_lift_args_s {
52         unsigned long precision;
53 };
54
55 extern ase_lift_f ase_lifttable[ASE_OPTABLE_SIZE][ASE_OPTABLE_SIZE];
56
57 extern Lisp_Object
58 ase_lift_undefined(Lisp_Object number, ent_lift_args_t SXE_UNUSED(unused));
59 extern Lisp_Object
60 ase_lift_trivial(Lisp_Object number, ent_lift_args_t SXE_UNUSED(unused));
61
62 extern_inline void
63 ent_lift_register(ase_object_type_t t1, ase_object_type_t t2, ase_lift_f lf);
64 extern_inline void
65 ent_lift_unregister(ase_object_type_t t1, ase_object_type_t t2);
66 extern_inline Lisp_Object
67 _ent_lift(
68         ase_object_type_t l1t, Lisp_Object l, ase_object_type_t l2t,
69         ent_lift_args_t la);
70 extern_inline Lisp_Object
71 ent_lift(Lisp_Object l, ase_object_type_t lt, ent_lift_args_t la);
72
73 \f
74 extern_inline void
75 ent_lift_register(ase_object_type_t t1, ase_object_type_t t2, ase_lift_f lf)
76 {
77         ase_lifttable[t1][t2] = lf;
78         return;
79 }
80
81 extern_inline void
82 ent_lift_unregister(ase_object_type_t t1, ase_object_type_t t2)
83 {
84         if (t1 != t2)
85                 ase_lifttable[t1][t2] = ase_lift_undefined;
86         else
87                 ase_lifttable[t1][t2] = ase_lift_trivial;
88         return;
89 }
90
91 extern void ase_lifttable_init(void);
92
93 extern_inline Lisp_Object
94 _ent_lift(ase_object_type_t l1t, Lisp_Object l, ase_object_type_t l2t,
95           ent_lift_args_t la)
96 {
97         ase_lift_f liftf = ase_lifttable[l1t][l2t];
98
99         return liftf(l, la);
100 }
101
102 extern_inline Lisp_Object
103 ent_lift(Lisp_Object l, ase_object_type_t lt, ent_lift_args_t la)
104 {
105         ase_object_type_t l1t = ase_optable_index(l);
106
107         return _ent_lift(l1t, l, lt, la);
108 }
109
110 #if 0
111 EXFUN(Fent_binrel_lessp, MANY);
112 EXFUN(Fent_binrel_greaterp, MANY);
113 EXFUN(Fent_binrel_equalp, MANY);
114 EXFUN(Fent_binrel_neqp, MANY);
115 #endif
116 EXFUN(Fent_lift, MANY);
117
118 extern void syms_of_ent_lift(void);
119 extern void vars_of_ent_lift(void);
120
121 #endif  /* INCLUDED_ent_lift_h_ */