Build Fix -- compatibility issue with newer autoconf
[sxemacs] / src / ent / ent-nullary-op.h
1 /*
2   ent-nullary-op.h -- Global Nullary Operations
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_nullary_op_h_
40 #define INCLUDED_ent_nullary_op_h_
41
42 #define ENT_DEBUG_NULLOP(args...)       ENT_DEBUG("[NULLOP]: " args)
43
44 /*************************/
45 /* new ASE optable magic */
46 /*************************/
47 /* the nullary optable */
48 typedef enum ase_nullary_operation_e ase_nullary_operation_t;
49 typedef Lisp_Object ase_nullary_operation_f;
50
51 enum ase_nullary_operation_e {
52         ASE_NULLARY_OP_ZERO,
53         ASE_NULLARY_FIRST_OP = ASE_NULLARY_OP_ZERO,
54         ASE_NULLARY_OP_ONE,
55         ASE_NULLARY_LAST_OP = ASE_NULLARY_OP_ONE,
56         N_ASE_NULLARY_OPS
57 };
58
59 extern ase_nullary_operation_f
60 ase_nullary_optable[N_ASE_NULLARY_OPS][ASE_OPTABLE_SIZE];
61
62 extern ase_nullary_operation_f ase_nullary_operation_undefined;
63
64 extern_inline void
65 ent_nullop_register(
66         ase_nullary_operation_t op,
67         ase_object_type_t t, ase_nullary_operation_f opf);
68 extern_inline void
69 ent_nullop_unregister(ase_nullary_operation_t op, ase_object_type_t t);
70 extern_inline Lisp_Object
71 _ent_nullop(ase_nullary_operation_t op, ase_object_type_t lt);
72 extern_inline Lisp_Object
73 ent_nullop(ase_nullary_operation_t op, Lisp_Object l);
74
75 \f
76 extern_inline void
77 ent_nullop_register(ase_nullary_operation_t op,
78                     ase_object_type_t t, ase_nullary_operation_f opf)
79 {
80         ase_nullary_optable[op][t] = opf;
81         return;
82 }
83 extern_inline void
84 ent_nullop_unregister(ase_nullary_operation_t op, ase_object_type_t t)
85 {
86         ase_nullary_optable[op][t] = ase_nullary_operation_undefined;
87         return;
88 }
89
90 extern void ase_nullary_optable_init(void);
91
92 extern_inline Lisp_Object
93 _ent_nullop(ase_nullary_operation_t op, ase_object_type_t lt)
94 {
95         ase_nullary_operation_f opf =
96                 ase_nullary_optable[op][lt];
97
98         return opf;
99 }
100 extern_inline Lisp_Object
101 ent_nullop(ase_nullary_operation_t op, Lisp_Object l)
102 {
103         ase_object_type_t lt = ase_optable_index(l);
104
105         return _ent_nullop(op, lt);
106 }
107
108 #define _ent_nullop_zero(_t)    _ent_nullop(ASE_NULLARY_OP_ZERO, _t)
109 #define ent_nullop_zero(_o)     ent_nullop(ASE_NULLARY_OP_ZERO, _o)
110 #define _ent_nullop_one(_t)     _ent_nullop(ASE_NULLARY_OP_ONE, _t)
111 #define ent_nullop_one(_o)      ent_nullop(ASE_NULLARY_OP_ONE, _o)
112
113 EXFUN(Fzero, 1);
114 EXFUN(Fone, 1);
115
116 extern void syms_of_ent_nullary_op(void);
117 extern void vars_of_ent_nullary_op(void);
118
119 #endif  /* INCLUDED_ent_nullary_op_h_ */