chiark / gitweb /
speaker: new comments to add/remove RTP recipients
[disorder] / lib / common.h
CommitLineData
460b9539 1/*
2 * This file is part of DisOrder.
5aff007d 3 * Copyright (C) 2004, 2005, 2007, 2008 Richard Kettlewell
460b9539 4 *
e7eb3a27 5 * This program is free software: you can redistribute it and/or modify
460b9539 6 * it under the terms of the GNU General Public License as published by
e7eb3a27 7 * the Free Software Foundation, either version 3 of the License, or
460b9539 8 * (at your option) any later version.
e7eb3a27
RK
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
460b9539 15 * You should have received a copy of the GNU General Public License
e7eb3a27 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
460b9539 17 */
05b75f8d
RK
18/** @file lib/common.h
19 * @brief Common includes and definitions
20 */
21
22#ifndef COMMON_H
23#define COMMON_H
460b9539 24
05b75f8d 25#include <config.h>
460b9539 26
27#if HAVE_INTTYPES_H
28# include <inttypes.h>
29#endif
30#include <limits.h>
31#include <sys/types.h>
32
33/* had better be before atol/atoll redefinition */
34#include <stdlib.h>
05b75f8d
RK
35#include <string.h>
36#include <stdio.h>
37#include <assert.h>
460b9539 38
39#if HAVE_LONG_LONG
40typedef long long long_long;
41typedef unsigned long long u_long_long;
42# if ! DECLARES_STRTOLL
43long long strtoll(const char *, char **, int);
44# endif
45# if ! DECLARES_ATOLL
46long long atoll(const char *);
47# endif
48#else
49typedef long long_long;
50typedef unsigned long u_long_long;
51# define atoll atol
52# define strtoll strtol
53#endif
54
55#if __APPLE__
56/* apple define these to j[dxu], which gcc -std=c99 -pedantic then rejects */
57# undef PRIdMAX
58# undef PRIxMAX
59# undef PRIuMAX
60#endif
61
62#if HAVE_INTMAX_T
63# ifndef PRIdMAX
64# define PRIdMAX "jd"
65# endif
66#elif HAVE_LONG_LONG
67typedef long long intmax_t;
68# define PRIdMAX "lld"
69#else
70typedef long intmax_t;
71# define PRIdMAX "ld"
72#endif
73
74#if HAVE_UINTMAX_T
75# ifndef PRIuMAX
76# define PRIuMAX "ju"
77# endif
78# ifndef PRIxMAX
79# define PRIxMAX "jx"
80# endif
81#elif HAVE_LONG_LONG
82typedef unsigned long long uintmax_t;
83# define PRIuMAX "llu"
84# define PRIxMAX "llx"
85#else
86typedef unsigned long uintmax_t;
87# define PRIuMAX "lu"
88# define PRIxMAX "lx"
89#endif
90
91#if ! HAVE_UINT8_T
92# if CHAR_BIT == 8
93typedef unsigned char uint8_t;
94# else
95# error cannot determine uint8_t
96# endif
97#endif
98
99#if ! HAVE_UINT32_T
100# if UINT_MAX == 4294967295
101typedef unsigned int uint32_t;
102# elif ULONG_MAX == 4294967295
103typedef unsigned long uint32_t;
104# elif USHRT_MAX == 4294967295
105typedef unsigned short uint32_t;
106# elif UCHAR_MAX == 4294967295
107typedef unsigned char uint32_t;
108# else
109# error cannot determine uint32_t
110# endif
111#endif
112
05b75f8d 113#endif /* COMMENT_H */
460b9539 114
115/*
116Local Variables:
117c-basic-offset:2
118comment-column:40
119End:
120*/