libcdio 2.3.0
types.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2008, 2012, 2017, 2019, 2024
3 Rocky Bernstein <rocky@gnu.org>
4 Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
23
24
25#ifndef CDIO_TYPES_H_
26#define CDIO_TYPES_H_
27
28#ifdef __cplusplus
29extern "C" {
30#else
31# include <stdbool.h>
32#endif /* __cplusplus */
33
34#include <stddef.h>
35
36/* If <sys/types.h> is not available on your platform please
37 contact the libcdio mailing list so that we can fix it! */
38#if !defined(ARE_THERE_STILL_ENVS_WITHOUT_SYS_TYPES)
39#include <sys/types.h>
40#endif
41
42#if defined(AMIGA)
43typedef u_int8_t uint8_t;
44typedef u_int16_t uint16_t;
45typedef u_int32_t uint32_t;
46typedef u_int64_t uint64_t;
47#else
48/* If <stdint.h> is not available on your platform please
49 contact the libcdio mailing list so that we can fix it!
50 For MSVC, you can find both a public domain stdint.h and
51 inttypes.h in the MSVC/missing directory of libcdio. */
52#include <stdint.h>
53#endif
54
55typedef uint8_t ubyte;
56
57/* MSVC does not define mode_t and ssize_t by default. The way
58 to compensate for missing UNIX types is to include a custom
59 unistd.h that defines them. Such a file is provided with
60 the libcdio source, in the MSVC/missing directory */
61#if defined(_MSC_VER)
62#include <unistd.h>
63#endif
64
65 /* default HP/UX macros are broken */
66#if defined(__hpux__)
67# undef UINT16_C
68# undef UINT32_C
69# undef UINT64_C
70# undef INT64_C
71#endif
72
73 /* if it's still not defined, take a good guess... should work for
74 most 32bit and 64bit archs */
75
76#ifndef UINT16_C
77# define UINT16_C(c) c ## U
78#endif
79
80#ifndef UINT32_C
81# if defined (SIZEOF_INT) && SIZEOF_INT == 4
82# define UINT32_C(c) c ## U
83# elif defined (SIZEOF_LONG) && SIZEOF_LONG == 4
84# define UINT32_C(c) c ## UL
85# else
86# define UINT32_C(c) c ## U
87# endif
88#endif
89
90#ifndef UINT64_C
91# if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
92# define UINT64_C(c) c ## UL
93# elif defined (SIZEOF_INT) && SIZEOF_INT == 8
94# define UINT64_C(c) c ## U
95# else
96# define UINT64_C(c) c ## ULL
97# endif
98#endif
99
100#ifndef INT64_C
101# if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
102# define INT64_C(c) c ## L
103# elif defined (SIZEOF_INT) && SIZEOF_INT == 8
104# define INT64_C(c) c
105# else
106# define INT64_C(c) c ## LL
107# endif
108#endif
109
110 /* some GCC optimizations -- gcc 2.5+ */
111
112#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
113#define GNUC_PRINTF( format_idx, arg_idx ) \
114 __attribute__((format (printf, format_idx, arg_idx)))
115#define GNUC_SCANF( format_idx, arg_idx ) \
116 __attribute__((format (scanf, format_idx, arg_idx)))
117#define GNUC_FORMAT( arg_idx ) \
118 __attribute__((format_arg (arg_idx)))
119#define GNUC_NORETURN \
120 __attribute__((noreturn))
121#define GNUC_CONST \
122 __attribute__((const))
123#define GNUC_UNUSED \
124 __attribute__((unused))
125#define GNUC_PACKED \
126 __attribute__((packed))
127#else /* !__GNUC__ */
128#define GNUC_PRINTF( format_idx, arg_idx )
129#define GNUC_SCANF( format_idx, arg_idx )
130#define GNUC_FORMAT( arg_idx )
131#define GNUC_NORETURN
132#define GNUC_CONST
133#define GNUC_UNUSED
134#define GNUC_PACKED
135#ifdef _MSC_VER
136#define __PRETTY_FUNCTION__ __FUNCSIG__
137#endif
138#endif /* !__GNUC__ */
139
140#if defined(__MINGW32__) || (defined( __clang_major__) && __clang_major__ > 9)
141# define PRAGMA_BEGIN_PACKED _Pragma("pack(push)") \
142 _Pragma("pack(1)")
143# define PRAGMA_END_PACKED _Pragma("pack(pop)")
144#elif __GNUC__ > 4 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901)
145 /* should work with GCC > 4.0 clang and most EDG-frontend based C
146 and C++ compilers */
147# define PRAGMA_BEGIN_PACKED _Pragma("pack(1)")
148# define PRAGMA_END_PACKED _Pragma("pack()")
149#elif defined(_MSC_VER)
150# define PRAGMA_BEGIN_PACKED __pragma(pack(push, 1))
151# define PRAGMA_END_PACKED __pragma(pack(pop))
152#else /* neither gcc nor _Pragma() available... */
153 /* ...so let's be naive and hope the regression testsuite is run... */
154# define PRAGMA_BEGIN_PACKED
155# define PRAGMA_END_PACKED
156#endif
157
158 /*
159 * user directed static branch prediction gcc 2.96+
160 */
161#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
162# define GNUC_LIKELY(x) __builtin_expect((x),true)
163# define GNUC_UNLIKELY(x) __builtin_expect((x),false)
164#else
165# define GNUC_LIKELY(x) (x)
166# define GNUC_UNLIKELY(x) (x)
167#endif
168
171#if defined(__GNUC__)
172# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5)
173# define LIBCDIO_DEPRECATED(object, notice) object __attribute__ ((deprecated(notice)))
174# else
175# define LIBCDIO_DEPRECATED(object, notice) object __attribute__ ((deprecated))
176# endif
177#elif defined(_MSC_VER)
178#define LIBCDIO_DEPRECATED(object, notice) __declspec(deprecated(notice)) object
179#else
180#define LIBCDIO_DEPRECATED(object, notice)
181#endif
182
184#define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
185
201 struct msf_s {
202 uint8_t m, s, f; /* BCD encoded! */
205
206 typedef struct msf_s msf_t;
207
208#define msf_t_SIZEOF 3
209
215
216 typedef char cdio_utf8_t;
217
218 typedef enum {
219 nope = 0,
220 yep = 1,
222 } bool_3way_t;
223
224 /* type used for bit-fields in structs (1 <= bits <= 8) */
225#if defined(__GNUC__)
226 /* this is strict ISO C99 which allows only 'unsigned int', 'signed
227 int' and '_Bool' explicitly as bit-field type */
228 typedef unsigned int bitfield_t;
229#else
230 /* other compilers might increase alignment requirements to match the
231 'unsigned int' type -- fixme: find out how unalignment accesses can
232 be pragma'ed on non-gcc compilers */
233 typedef uint8_t bitfield_t;
234#endif
235
241 typedef int32_t lba_t;
242
248 typedef int32_t lsn_t;
249
250 /* Address in either MSF or logical format */
256
258 typedef uint8_t track_t;
259
261 typedef uint8_t session_t;
262
266#define CDIO_INVALID_SESSION 0xFF
267
273#define CDIO_INVALID_LBA -45301
274
278#define CDIO_INVALID_LSN CDIO_INVALID_LBA
279
284#define CDIO_MCN_SIZE 13
285
290 typedef char cdio_mcn_t[CDIO_MCN_SIZE+1];
291
292
296#define CDIO_ISRC_SIZE 12
297
303
304 typedef int cdio_fs_anal_t;
305
319
320
321/* Note that this matches the free() prototype.*/
322typedef void (*CdioDataFree_t)(void *ptr);
323
324#ifdef __cplusplus
325}
326#endif /* __cplusplus */
327
328#endif /* CDIO_TYPES_H_ */
329
330
331/*
332 * Local variables:
333 * c-file-style: "gnu"
334 * tab-width: 8
335 * indent-tabs-mode: nil
336 * End:
337 */
MSF (minute/second/frame) structure.
Definition types.h:201
uint8_t s
Definition types.h:202
uint8_t m
Definition types.h:202
uint8_t f
Definition types.h:202
uint8_t session_t
Definition types.h:261
bool_3way_t
Definition types.h:218
@ nope
Definition types.h:219
@ yep
Definition types.h:220
@ dunno
Definition types.h:221
char cdio_utf8_t
UTF-8 char definition.
Definition types.h:216
typedefPRAGMA_END_PACKED struct msf_s msf_t
Definition types.h:206
#define PRAGMA_BEGIN_PACKED
Definition types.h:154
#define PRAGMA_END_PACKED
Definition types.h:155
#define CDIO_ISRC_SIZE
Definition types.h:296
char cdio_mcn_t[CDIO_MCN_SIZE+1]
Definition types.h:290
uint8_t track_t
Definition types.h:258
uint8_t bitfield_t
Definition types.h:233
cdio_track_flag
Definition types.h:310
@ CDIO_TRACK_FLAG_DATA
Definition types.h:315
@ CDIO_TRACK_FLAG_PRE_EMPHASIS
Definition types.h:312
@ CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO
Definition types.h:316
@ CDIO_TRACK_FLAG_SCMS
Definition types.h:317
@ CDIO_TRACK_FLAG_COPY_PERMITTED
Definition types.h:314
@ CDIO_TRACK_FLAG_NONE
Definition types.h:311
#define GNUC_PACKED
Definition types.h:134
int cdio_fs_anal_t
Definition types.h:304
int32_t lba_t
Definition types.h:241
int32_t lsn_t
Definition types.h:248
#define CDIO_MCN_SIZE
Definition types.h:284
void(* CdioDataFree_t)(void *ptr)
Definition types.h:322
uint8_t ubyte
Definition types.h:55
char cdio_isrc_t[CDIO_ISRC_SIZE+1]
Definition types.h:302
Definition types.h:252
lba_t lba
Definition types.h:254
msf_t msf
Definition types.h:253

Generated for libcdio by doxygen 1.16.1