Merge remote-tracking branch 'origin/master' into for-steve
[sxemacs] / src / ent / ent-nullary-op.c
1 /*
2   ent-nullary-op.c -- 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 #include <config.h>
40 #include "lisp.h"
41 #include "ent-nullary-op.h"
42
43 ase_nullary_operation_f ase_nullary_optable
44 [N_ASE_NULLARY_OPS][ASE_OPTABLE_SIZE];
45
46 \f
47 ase_nullary_operation_f ase_nullary_operation_undefined;
48
49 static inline void
50 _ase_nullary_optable_init(ase_nullary_operation_t op)
51 {
52         ase_object_type_t i;
53         for (i = 0; i < ASE_OPTABLE_SIZE; i++) {
54                 ent_nullop_unregister(op, i);
55         }
56 }
57
58 void
59 ase_nullary_optable_init(void)
60 {
61         ase_nullary_operation_t op;
62         ase_nullary_operation_undefined = Qunbound;
63         for (op = ASE_NULLARY_FIRST_OP; op < N_ASE_NULLARY_OPS; op++) {
64                 _ase_nullary_optable_init(op);
65         }
66 }
67
68 \f
69 DEFUN("zero", Fzero, 1, 1, 0, /*
70 Return the zero of the world NUMBER lives in.
71 */
72        (number))
73 {
74         return ent_nullop(ASE_NULLARY_OP_ZERO, number);
75 }
76
77 DEFUN("one", Fone, 1, 1, 0, /*
78 Return the one of the world NUMBER lives in.
79 */
80        (number))
81 {
82         return ent_nullop(ASE_NULLARY_OP_ONE, number);
83 }
84
85 \f
86 void
87 syms_of_ent_nullary_op(void)
88 {
89         DEFSUBR(Fzero);
90         DEFSUBR(Fone);
91 }
92
93 void
94 vars_of_ent_nullary_op(void)
95 {
96 }
97
98 /* ent-nullary-op.c ends here */