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