xref: /freebsd/contrib/less/lang.h (revision c77c488926555ca344ae3a417544cf7a720e1de1)
1*c77c4889SXin LI /*
2*c77c4889SXin LI  * Copyright (C) 1984-2024  Mark Nudelman
3*c77c4889SXin LI  *
4*c77c4889SXin LI  * You may distribute under the terms of either the GNU General Public
5*c77c4889SXin LI  * License or the Less License, as specified in the README file.
6*c77c4889SXin LI  *
7*c77c4889SXin LI  * For more information, see the README file.
8*c77c4889SXin LI  */
9*c77c4889SXin LI 
10*c77c4889SXin LI #ifndef LESS_LANG_H_
11*c77c4889SXin LI #define LESS_LANG_H_ 1
12*c77c4889SXin LI 
13*c77c4889SXin LI /*
14*c77c4889SXin LI  * C language details.
15*c77c4889SXin LI  */
16*c77c4889SXin LI #if HAVE_CONST
17*c77c4889SXin LI #define constant        const
18*c77c4889SXin LI #else
19*c77c4889SXin LI #define constant
20*c77c4889SXin LI #endif
21*c77c4889SXin LI 
22*c77c4889SXin LI /*
23*c77c4889SXin LI  * mutable is the opposite of constant.
24*c77c4889SXin LI  * It documents that a pointer parameter will be written through by the
25*c77c4889SXin LI  * called function, more directly than by the mere absence of "constant".
26*c77c4889SXin LI  */
27*c77c4889SXin LI #define mutable
28*c77c4889SXin LI 
29*c77c4889SXin LI #define public          /* PUBLIC FUNCTION */
30*c77c4889SXin LI 
31*c77c4889SXin LI #undef  ptr_diff
32*c77c4889SXin LI #define ptr_diff(p1,p2)  ((size_t) ((p1)-(p2)))
33*c77c4889SXin LI #undef  countof
34*c77c4889SXin LI #define countof(a)       ((int)(sizeof(a)/sizeof(*a)))
35*c77c4889SXin LI 
36*c77c4889SXin LI #define size_t_null      ((size_t)-1)
37*c77c4889SXin LI 
38*c77c4889SXin LI #ifndef NULL
39*c77c4889SXin LI #define NULL    0
40*c77c4889SXin LI #endif
41*c77c4889SXin LI 
42*c77c4889SXin LI typedef enum lbool { LFALSE, LTRUE } lbool;
43*c77c4889SXin LI 
44*c77c4889SXin LI #undef  TRUE
45*c77c4889SXin LI #define TRUE  LTRUE
46*c77c4889SXin LI #undef  FALSE
47*c77c4889SXin LI #define FALSE LFALSE
48*c77c4889SXin LI 
49*c77c4889SXin LI #ifdef _MSC_VER
50*c77c4889SXin LI #if _WIN64
51*c77c4889SXin LI typedef __int64 ssize_t;
52*c77c4889SXin LI #else
53*c77c4889SXin LI typedef __int32 ssize_t;
54*c77c4889SXin LI #endif
55*c77c4889SXin LI #endif
56*c77c4889SXin LI 
57*c77c4889SXin LI #endif //  LESS_LANG_H_
58