Initial git import
[sxemacs] / src / ent / ent-int.h
1 /*
2   ent-int.c -- Ordinary Integers for SXEmacs
3   Copyright (C) 2005, 2006 Sebastian Freundt
4
5   Author:  Sebastian Freundt
6
7 This file is part of SXEmacs
8
9 SXEmacs is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 SXEmacs is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
21
22
23 #ifndef INCLUDED_ent_int_h_
24 #define INCLUDED_ent_int_h_
25
26 #ifdef UNO
27 /* Uno complains about several inline functions that include conditions with
28    assignments and side effects if we don't do this */
29 #undef __GNUC__
30 #endif
31
32 extern EMACS_INT Vmost_negative_int, Vmost_positive_int;
33 extern Lisp_Object Qzero, Qone;
34
35 #if defined HAVE_MPZ && (defined WITH_GMP || defined WITH_MP)
36 #define make_integer(x)                                                 \
37         (NUMBER_FITS_IN_AN_EMACS_INT(x) ? make_int(x) : make_bigz(x))
38 #else
39 #define make_integer(x) make_int(x)
40 #endif
41
42 extern Bufpos marker_position(Lisp_Object);
43 extern_inline EMACS_INT ent_int(Lisp_Object);
44
45 \f
46 extern_inline EMACS_INT
47 ent_int(Lisp_Object number)
48 {
49         if (!CHARP(number) && !MARKERP(number))
50                 return XINT(number);
51         else if (CHARP(number))
52                 return XCHAR(number);
53         else if (MARKERP(number))
54                 return marker_position(number);
55         else
56                 return 0;
57 }
58
59 extern void init_optables_INT_T(void);
60 extern void init_ent_int(void);
61 extern void syms_of_ent_int(void);
62 extern void vars_of_ent_int(void);
63
64 #endif /* INCLUDED_ent_int_h_ */