Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00026
00027 #ifndef __CDIO_TYPES_H__
00028 #define __CDIO_TYPES_H__
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034 #ifndef EXTERNAL_LIBCDIO_CONFIG_H
00035 #define EXTERNAL_LIBCDIO_CONFIG_H
00036 #include <cdio/cdio_config.h>
00037 #endif
00038
00039 #ifdef HAVE_SYS_TYPES_H
00040 #include <sys/types.h>
00041 #endif
00042
00043
00044
00045 #if defined(HAVE_SYS_TYPES_H)
00046 #include <sys/types.h>
00047 #endif
00048
00049 #if defined(HAVE_STDINT_H)
00050 # include <stdint.h>
00051 #elif defined(HAVE_INTTYPES_H)
00052 # include <inttypes.h>
00053 #elif defined(AMIGA) || defined(__linux__)
00054 typedef u_int8_t uint8_t;
00055 typedef u_int16_t uint16_t;
00056 typedef u_int32_t uint32_t;
00057 typedef u_int64_t uint64_t;
00058 #else
00059
00060
00061 #endif
00062
00063 typedef uint8_t ubyte;
00064
00065
00066 #if defined(__hpux__)
00067 # undef UINT16_C
00068 # undef UINT32_C
00069 # undef UINT64_C
00070 # undef INT64_C
00071 #endif
00072
00073
00074
00075
00076 #ifndef UINT16_C
00077 # define UINT16_C(c) c ## U
00078 #endif
00079
00080 #ifndef UINT32_C
00081 # if defined (SIZEOF_INT) && SIZEOF_INT == 4
00082 # define UINT32_C(c) c ## U
00083 # elif defined (SIZEOF_LONG) && SIZEOF_LONG == 4
00084 # define UINT32_C(c) c ## UL
00085 # else
00086 # define UINT32_C(c) c ## U
00087 # endif
00088 #endif
00089
00090 #ifndef UINT64_C
00091 # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
00092 # define UINT64_C(c) c ## UL
00093 # elif defined (SIZEOF_INT) && SIZEOF_INT == 8
00094 # define UINT64_C(c) c ## U
00095 # else
00096 # define UINT64_C(c) c ## ULL
00097 # endif
00098 #endif
00099
00100 #ifndef INT64_C
00101 # if defined (SIZEOF_LONG) && SIZEOF_LONG == 8
00102 # define INT64_C(c) c ## L
00103 # elif defined (SIZEOF_INT) && SIZEOF_INT == 8
00104 # define INT64_C(c) c
00105 # else
00106 # define INT64_C(c) c ## LL
00107 # endif
00108 #endif
00109
00110 #ifndef __cplusplus
00111 # if defined(_AIX52)
00112 # include <stdbool.h>
00113 # else
00114
00115
00116 # define false 0
00117 # define true 1
00118 # define bool uint8_t
00119 # endif
00120 #endif
00121
00122
00123
00124 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
00125 #define GNUC_PRINTF( format_idx, arg_idx ) \
00126 __attribute__((format (printf, format_idx, arg_idx)))
00127 #define GNUC_SCANF( format_idx, arg_idx ) \
00128 __attribute__((format (scanf, format_idx, arg_idx)))
00129 #define GNUC_FORMAT( arg_idx ) \
00130 __attribute__((format_arg (arg_idx)))
00131 #define GNUC_NORETURN \
00132 __attribute__((noreturn))
00133 #define GNUC_CONST \
00134 __attribute__((const))
00135 #define GNUC_UNUSED \
00136 __attribute__((unused))
00137 #define GNUC_PACKED \
00138 __attribute__((packed))
00139 #else
00140 #define GNUC_PRINTF( format_idx, arg_idx )
00141 #define GNUC_SCANF( format_idx, arg_idx )
00142 #define GNUC_FORMAT( arg_idx )
00143 #define GNUC_NORETURN
00144 #define GNUC_CONST
00145 #define GNUC_UNUSED
00146 #define GNUC_PACKED
00147 #endif
00148
00149 #if defined(__GNUC__)
00150
00151 # define PRAGMA_BEGIN_PACKED
00152 # define PRAGMA_END_PACKED
00153 #elif defined(HAVE_ISOC99_PRAGMA)
00154
00155 # define PRAGMA_BEGIN_PACKED _Pragma("pack(1)")
00156 # define PRAGMA_END_PACKED _Pragma("pack()")
00157 #else
00158
00159 # define PRAGMA_BEGIN_PACKED
00160 # define PRAGMA_END_PACKED
00161 #endif
00162
00163
00164
00165
00166 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
00167 # define GNUC_LIKELY(x) __builtin_expect((x),true)
00168 # define GNUC_UNLIKELY(x) __builtin_expect((x),false)
00169 #else
00170 # define GNUC_LIKELY(x) (x)
00171 # define GNUC_UNLIKELY(x) (x)
00172 #endif
00173
00174 #ifndef NULL
00175 # define NULL ((void*) 0)
00176 #endif
00177
00178
00179 #define __cd_offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00180
00195 PRAGMA_BEGIN_PACKED
00196 struct msf_s {
00197 uint8_t m, s, f;
00198 } GNUC_PACKED;
00199 PRAGMA_END_PACKED
00200
00201 typedef struct msf_s msf_t;
00202
00203 #define msf_t_SIZEOF 3
00204
00211 typedef char cdio_utf8_t;
00212
00213 typedef enum {
00214 nope = 0,
00215 yep = 1,
00216 dunno = 2
00217 } bool_3way_t;
00218
00219
00220 #if defined(__GNUC__)
00221
00222
00223 typedef unsigned int bitfield_t;
00224 #else
00225
00226
00227
00228 typedef uint8_t bitfield_t;
00229 #endif
00230
00236 typedef int32_t lba_t;
00237
00243 typedef int32_t lsn_t;
00244
00245
00246 union cdio_cdrom_addr
00247 {
00248 msf_t msf;
00249 lba_t lba;
00250 };
00251
00253 typedef uint8_t track_t;
00254
00256 typedef uint8_t session_t;
00257
00261 #define CDIO_INVALID_SESSION 0xFF
00262
00268 #define CDIO_INVALID_LBA -45301
00269
00273 #define CDIO_INVALID_LSN CDIO_INVALID_LBA
00274
00278 #define CDIO_MCN_SIZE 13
00279
00284 typedef char cdio_mcn_t[CDIO_MCN_SIZE+1];
00285
00286
00290 #define CDIO_ISRC_SIZE 12
00291
00296 typedef char cdio_isrc_t[CDIO_ISRC_SIZE+1];
00297
00298 typedef int cdio_fs_anal_t;
00299
00304 typedef enum {
00305 CDIO_TRACK_FLAG_NONE = 0x00,
00306 CDIO_TRACK_FLAG_PRE_EMPHASIS = 0x01,
00308 CDIO_TRACK_FLAG_COPY_PERMITTED = 0x02,
00309 CDIO_TRACK_FLAG_DATA = 0x04,
00310 CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO = 0x08,
00311 CDIO_TRACK_FLAG_SCMS = 0x10
00312 } cdio_track_flag;
00313
00314 #ifdef __cplusplus
00315 }
00316 #endif
00317
00318 #endif
00319
00320
00321
00322
00323
00324
00325
00326
00327