TaPAS  0.2
ccl-common.h
Go to the documentation of this file.
1 /*
2  * ccl-common.h -- Common macros and types definitions
3  *
4  * This file is a part of the C Common Library (CCL) project.
5  *
6  * Copyright (C) 2010 CNRS UMR 5800 & Universit√© Bordeaux I (see AUTHORS file).
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the AltaRica Public License that comes with this
10  * package.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  */
16 
22 #ifndef __CCL_COMMON_H__
23 # define __CCL_COMMON_H__
24 
25 # include <ccl/ccl-config.h>
26 
27 # if CCL_HAVE_STDIO_H
28 # include <stdio.h>
29 # endif /* CCL_HAVE_STDIO_H */
30 
31 # if CCL_HAVE_STDLIB_H
32 # include <stdlib.h>
33 # endif /* CCL_HAVE_STDLIB_H */
34 
35 #ifdef CCL_HAVE_SYS_TYPES_H
36 # include <sys/types.h>
37 #endif
38 
39 #ifdef CCL_HAVE_SYS_STAT_H
40 # include <sys/stat.h>
41 #endif
42 
43 #ifdef CCL_STDC_HEADERS
44 # include <stdlib.h>
45 # include <stddef.h>
46 #else
47 # ifdef CCL_HAVE_STDLIB_H
48 # include <stdlib.h>
49 # endif
50 #endif
51 
52 #ifdef CCL_HAVE_STRING_H
53 # if !defined CCL_STDC_HEADERS && defined CCL_HAVE_MEMORY_H
54 # include <memory.h>
55 # endif
56 # include <string.h>
57 #endif
58 
59 #ifdef CCL_HAVE_STRINGS_H
60 # include <strings.h>
61 #endif
62 
63 #ifdef CCL_HAVE_INTTYPES_H
64 # include <inttypes.h>
65 #endif
66 
67 #ifdef CCL_HAVE_STDINT_H
68 # include <stdint.h>
69 #endif
70 
71 #ifdef CCL_HAVE_UNISTD_H
72 # include <unistd.h>
73 #endif
74 
75 # if CCL_HAVE_STDARG_H
76 # include <stdarg.h>
77 # endif /* CCL_HAVE_STDARG_H */
78 
79 # ifdef _ccl_size_t
80 # define size_t _ccl_size_t
81 # endif /* _ccl_size_t */
82 
83 # ifdef _ccl_uint_32_t
84 # define uint32_t _ccl_uint32_t
85 # endif
86 
87 # ifdef _ccl_uintptr_t
88 # define uintptr_t _ccl_uintptr_t
89 # endif
90 
91 # ifndef BEGIN_C_DECLS
92 # ifdef __cplusplus
93 # define BEGIN_C_DECLS extern "C" {
94 # define END_C_DECLS }
95 # else /* ! __cpluplus */
96 # define BEGIN_C_DECLS
97 # define END_C_DECLS
98 # endif /* ! __cpluplus */
99 # endif /* ! BEGIN_C_DECLS */
100 
101 # ifndef NULL
102 # define NULL ((void *) ((uintptr_t) 0))
103 # endif
104 
108 # define CCL_NOP() ((void) 0)
109 
114 # define CCL_BITPTR(_type,_p) ((_type)(((uintptr_t)(_p))|((uintptr_t)1)))
115 
120 # define CCL_PTRHASBIT(_p) (((uintptr_t)(_p))&((uintptr_t)1))
121 
126 # define CCL_BITPTR2PTR(_type,_p) ((_type)(((uintptr_t)(_p))&(~(uintptr_t)1)))
127 
132 #define CCL_FIXME(_comment_) ((void)0)
133 
134 #endif /* ! __CCL_COMMON_H__ */