2 ent-lift.h -- Global Lifting
3 Copyright (C) 2006, 2007, 2008 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_ent_lift_h_
40 #define INCLUDED_ent_lift_h_
42 #define ENT_DEBUG_LIFT(args...) ENT_DEBUG("[LIFT]: " args)
44 /*************************/
45 /* new ASE optable magic */
46 /*************************/
48 typedef struct ent_lift_args_s *ent_lift_args_t;
49 typedef Lisp_Object(*ase_lift_f)(Lisp_Object, ent_lift_args_t);
51 struct ent_lift_args_s {
52 unsigned long precision;
55 extern ase_lift_f ase_lifttable[ASE_OPTABLE_SIZE][ASE_OPTABLE_SIZE];
58 ase_lift_undefined(Lisp_Object number, ent_lift_args_t SXE_UNUSED(unused));
60 ase_lift_trivial(Lisp_Object number, ent_lift_args_t SXE_UNUSED(unused));
63 ent_lift_register(ase_object_type_t t1, ase_object_type_t t2, ase_lift_f lf);
65 ent_lift_unregister(ase_object_type_t t1, ase_object_type_t t2);
66 extern_inline Lisp_Object
68 ase_object_type_t l1t, Lisp_Object l, ase_object_type_t l2t,
70 extern_inline Lisp_Object
71 ent_lift(Lisp_Object l, ase_object_type_t lt, ent_lift_args_t la);
75 ent_lift_register(ase_object_type_t t1, ase_object_type_t t2, ase_lift_f lf)
77 ase_lifttable[t1][t2] = lf;
82 ent_lift_unregister(ase_object_type_t t1, ase_object_type_t t2)
85 ase_lifttable[t1][t2] = ase_lift_undefined;
87 ase_lifttable[t1][t2] = ase_lift_trivial;
91 extern void ase_lifttable_init(void);
93 extern_inline Lisp_Object
94 _ent_lift(ase_object_type_t l1t, Lisp_Object l, ase_object_type_t l2t,
97 ase_lift_f liftf = ase_lifttable[l1t][l2t];
102 extern_inline Lisp_Object
103 ent_lift(Lisp_Object l, ase_object_type_t lt, ent_lift_args_t la)
105 ase_object_type_t l1t = ase_optable_index(l);
107 return _ent_lift(l1t, l, lt, la);
111 EXFUN(Fent_binrel_lessp, MANY);
112 EXFUN(Fent_binrel_greaterp, MANY);
113 EXFUN(Fent_binrel_equalp, MANY);
114 EXFUN(Fent_binrel_neqp, MANY);
116 EXFUN(Fent_lift, MANY);
118 extern void syms_of_ent_lift(void);
119 extern void vars_of_ent_lift(void);
121 #endif /* INCLUDED_ent_lift_h_ */