source: project/release/4/readline/tags/4.1.3/trunk/musthaves.h @ 34923

Last change on this file since 34923 was 34923, checked in by Alexej Magura, 3 years ago

releasing version 4.1.3: heres to a build that hopefully isnt broken

File size: 2.7 KB
Line 
1/****
2Copyright 2015 Alexej Magura
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15****/
16#if !defined(RDLN_MUSTHAVES_H_GUARD)
17# define RDLN_MUSTHAVES_H_GUARD 1
18/* BEGIN_C_DECLS should be used at the beginning of your declarations,
19so that C++ compilers don't mangle their names.  Use END_C_DECLS at
20the end of C declarations. */
21# undef BEGIN_C_DECLS
22# undef END_C_DECLS
23# ifdef __cplusplus
24#  define BEGIN_C_DECLS extern "C" {
25#  define END_C_DECLS }
26# else
27#  define BEGIN_C_DECLS /* empty */
28#  define END_C_DECLS /* empty */
29# endif
30
31/* PARAMS is a macro used to wrap function prototypes, so that
32  compilers that don't understand ANSI C prototypes still work,
33  and ANSI C compilers can issue warnings about type mismatches. */
34# undef PARAMS
35# if defined (__STDC__) || defined (_AIX) \
36     || (defined (__mips) && defined (_SYSTYPE_SVR4))   \
37     || defined(WIN32) || defined(__cplusplus)
38#  define PARAMS(protos) protos
39# else
40#  define PARAMS(protos) ()
41# endif
42
43BEGIN_C_DECLS
44
45# if !defined(_GNU_SOURCE)
46#  define _GNU_SOURCE 1
47# endif
48
49# if !defined(RD_DEBUG)
50#  define RD_DEBUG 0
51# endif
52
53# if !defined(RD_TEST)
54#  define RD_TEST 0
55# endif
56
57# if RD_DEBUG
58#  define RD_DBG(format, ...)                                   \
59     do {                                                       \
60          fprintf(stderr, "## (%s)(%s)%d\n",                    \
61                  "RD_DBG:", __FILE__, __LINE__);               \
62          fprintf(stderr, "#  `%s'\n", __FUNCTION__);           \
63          fprintf(stderr, (format), ##__VA_ARGS__);             \
64          fprintf(stderr, "\n");                                \
65     } while(0)
66# else
67#  define RD_DBG(format, ...)
68# endif
69
70# if !defined(bzero)
71#  define bzero(COM_B, COM_LEN)                                         \
72     (memset((void *)(COM_B), '\0', (size_t)(COM_LEN)), (void)0)
73# endif
74
75# if !defined(bcopy)
76#  define bcopy(COM_B1, COM_B2, COM_LEN)                        \
77     (memmove((void *)(COM_B2),                                 \
78              (const void *)(COM_B1),                           \
79              (size_t)(COM_LEN)),                               \
80      (void)0)
81# endif
82
83# if !defined(mempcpy)
84#  define mempcpy(COM_D, COM_S, COM_L)          \
85     (memcpy((void *)(COM_D),                   \
86             (const void *)(COM_S),             \
87             (size_t)(COM_L))                   \
88      + (size_t)(COM_L))
89# endif
90
91# if !defined(mempmove)
92#  define mempmove(COM_D, COM_S, COM_L)         \
93     (memmove((void *)(COM_D),                  \
94              (const void *)(COM_S),            \
95              (size_t)(COM_L))                  \
96      + (size_t)(COM_L))
97# endif
98
99END_C_DECLS
100
101#endif
Note: See TracBrowser for help on using the repository browser.