From b8a37ff2660beb67cbee29ee56744326f75016c0 Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 1 Nov 2004 09:14:21 +0000 Subject: [PATCH] Merging in MSVC/XBOX from John Oseman --- MSVC/config.h | 188 ++++++++++++++++++++++++++++++++++++++++++++ MSVC/stdint.h | 184 +++++++++++++++++++++++++++++++++++++++++++ Makefile.am | 6 +- lib/_cdio_generic.c | 5 +- lib/portable.h | 20 ++++- 5 files changed, 398 insertions(+), 5 deletions(-) create mode 100644 MSVC/config.h create mode 100755 MSVC/stdint.h diff --git a/MSVC/config.h b/MSVC/config.h new file mode 100644 index 00000000..5a06eb08 --- /dev/null +++ b/MSVC/config.h @@ -0,0 +1,188 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* compiler does lsbf in struct bitfields */ +#undef BITFIELD_LSBF + +/* Define 1 if you are compiling using cygwin */ +#undef CYGWIN + +/* what to put between the brackets for empty arrays */ +#define EMPTY_ARRAY_SIZE + +/* Define 1 if you have BSDI-type CD-ROM support */ +#undef HAVE_BSDI_CDROM + +/* Define to 1 if you have the `bzero' function. */ +#undef HAVE_BZERO + +/* Define this if you have libcddb installed */ +#undef HAVE_CDDB + +/* Define to 1 if you have the header file. */ +#undef HAVE_COREFOUNDATION_CFBASE_H + +/* Define 1 if you have Darwin OS X-type CD-ROM support */ +#undef HAVE_DARWIN_CDROM + +/* Define if time.h defines extern long timezone and int daylight vars. */ +#undef HAVE_DAYLIGHT + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DVD_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define 1 if you have FreeBSD CD-ROM support */ +#undef HAVE_FREEBSD_CDROM + +/* Define to 1 if you have the header file. */ +#undef HAVE_GLOB_H + +/* Define if you have the iconv() function. */ +#undef HAVE_ICONV + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_IOKIT_IOKITLIB_H + +/* Supports ISO _Pragma() macro */ +#undef HAVE_ISOC99_PRAGMA + +/* Define 1 if you want ISO-9660 Joliet extension support. You must have also + libiconv installed to get Joliet extension support. */ +#undef HAVE_JOLIET + +/* Define if you have and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define 1 if you have Linux-type CD-ROM support */ +#undef HAVE_LINUX_CDROM + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_CDROM_H + +/* Define 1 if timeout is in cdrom_generic_command struct */ +#undef HAVE_LINUX_CDROM_TIMEOUT + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_VERSION_H + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define 1 if you have Solaris CD-ROM support */ +#undef HAVE_SOLARIS_CDROM + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_CDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define if struct tm has the tm_gmtoff member. */ +#undef HAVE_TM_GMTOFF + +/* Define if time.h defines extern extern char *tzname[2] variable */ +#undef HAVE_TZNAME + +/* Define to 1 if you have the `tzset' function. */ +#undef HAVE_TZSET + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define this if you have libvcdinfo installed */ +#undef HAVE_VCDINFO + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define 1 if you have MinGW CD-ROM support */ +#define HAVE_WIN32_CDROM 1 + +/* Define as const if the declaration of iconv() needs const. */ +#undef ICONV_CONST + +/* Define 1 if you are compiling using MinGW */ +#undef MINGW32 + +/* Name of package */ +#define PACKAGE "libcdio" + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libcdio" + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#define PACKAGE_VERSION 1 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "1" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#define inline + diff --git a/MSVC/stdint.h b/MSVC/stdint.h new file mode 100755 index 00000000..2ea752fa --- /dev/null +++ b/MSVC/stdint.h @@ -0,0 +1,184 @@ +/* ISO C9x 7.18 Integer types + * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * Contributor: Danny Smith + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Date: 2000-12-02 + */ + + +#ifndef _STDINT_H +#define _STDINT_H +#define __need_wint_t +#define __need_wchar_t +#include + +/* 7.18.1.1 Exact-width integer types */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned uint32_t; +typedef long long int64_t; +typedef unsigned long long uint64_t; + +/* 7.18.1.2 Minimum-width integer types */ +typedef signed char int_least8_t; +typedef unsigned char uint_least8_t; +typedef short int_least16_t; +typedef unsigned short uint_least16_t; +typedef int int_least32_t; +typedef unsigned uint_least32_t; +typedef long long int_least64_t; +typedef unsigned long long uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types + * Not actually guaranteed to be fastest for all purposes + * Here we use the exact-width types for 8 and 16-bit ints. + */ +typedef char int_fast8_t; +typedef unsigned char uint_fast8_t; +typedef short int_fast16_t; +typedef unsigned short uint_fast16_t; +typedef int int_fast32_t; +typedef unsigned int uint_fast32_t; +typedef long long int_fast64_t; +typedef unsigned long long uint_fast64_t; + +/* 7.18.1.4 Integer types capable of holding object pointers */ +typedef int intptr_t; +typedef unsigned uintptr_t; + +/* 7.18.1.5 Greatest-width integer types */ +typedef long long intmax_t; +typedef unsigned long long uintmax_t; + +/* 7.18.2 Limits of specified-width integer types */ +#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) + +/* 7.18.2.1 Limits of exact-width integer types */ +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647 - 1) +#define INT64_MIN (-9223372036854775807LL - 1) + +#define INT8_MAX 127 +#define INT16_MAX 32767 +#define INT32_MAX 2147483647 +#define INT64_MAX 9223372036854775807LL + +#define UINT8_MAX 0xff /* 255U */ +#define UINT16_MAX 0xffff /* 65535U */ +#define UINT32_MAX 0xffffffff /* 4294967295U */ +#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ + +/* 7.18.2.2 Limits of minimum-width integer types */ +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +/* 7.18.2.3 Limits of fastest minimum-width integer types */ +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +/* 7.18.2.4 Limits of integer types capable of holding + object pointers */ +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX + +/* 7.18.2.5 Limits of greatest-width integer types */ +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +/* 7.18.3 Limits of other integer types */ +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX + +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX + +#define SIZE_MAX UINT32_MAX + +#ifndef WCHAR_MIN /* also in wchar.h */ +#define WCHAR_MIN 0 +#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ +#endif + +/* + * wint_t is unsigned short for compatibility with MS runtime + */ +#define WINT_MIN 0 +#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */ + +#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ + + +/* 7.18.4 Macros for integer constants */ +#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) + +/* 7.18.4.1 Macros for minimum-width integer constants + + Accoding to Douglas Gwyn : + "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC + 9899:1999 as initially published, the expansion was required + to be an integer constant of precisely matching type, which + is impossible to accomplish for the shorter types on most + platforms, because C99 provides no standard way to designate + an integer constant with width less than that of type int. + TC1 changed this to require just an integer constant + *expression* with *promoted* type." +*/ + +#define INT8_C(val) ((int8_t) + (val)) +#define UINT8_C(val) ((uint8_t) + (val##U)) +#define INT16_C(val) ((int16_t) + (val)) +#define UINT16_C(val) ((uint16_t) + (val##U)) + +#define INT32_C(val) val##L +#define UINT32_C(val) val##UL +#define INT64_C(val) val##LL +#define UINT64_C(val) val##ULL + +/* 7.18.4.2 Macros for greatest-width integer constants */ +#define INTMAX_C(val) INT64_C(val) +#define UINTMAX_C(val) UINT64_C(val) + +#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ + +#endif diff --git a/Makefile.am b/Makefile.am index 9e9123c3..1fa92f69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.22 2004/10/24 14:32:50 rocky Exp $ +# $Id: Makefile.am,v 1.23 2004/11/01 09:14:21 rocky Exp $ # # Copyright (C) 2003, 2004 Rocky Bernstein # @@ -21,7 +21,9 @@ ## which make can then use to produce stuff. Isn't configuration simple? EXTRA_DIST = config.rpath codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 intmax.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 longdouble.m4 longlong.m4 nls.m4 po.m4 printf-posix.m4 progtest.m4 signed.m4 size_max.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 wchar_t.m4 wint_t.m4 xsize.m4 libpopt.m4 THANKS README.libcdio libcdio.spec.in libcdio.spec \ - example/README + example/README \ + MSVC/config.h MSVC/README MSVC/cd-info.vcproj MSVC/config.h \ + MSVC/libcdio.sln MSVC/libcdio.vdproj MSVC/stdint.h SUBDIRS = doc include lib src test example diff --git a/lib/_cdio_generic.c b/lib/_cdio_generic.c index ffef81ce..317f943b 100644 --- a/lib/_cdio_generic.c +++ b/lib/_cdio_generic.c @@ -1,5 +1,5 @@ /* - $Id: _cdio_generic.c,v 1.28 2004/10/31 13:58:44 rocky Exp $ + $Id: _cdio_generic.c,v 1.29 2004/11/01 09:14:21 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -25,7 +25,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.28 2004/10/31 13:58:44 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.29 2004/11/01 09:14:21 rocky Exp $"; #include #include @@ -47,6 +47,7 @@ static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.28 2004/10/31 13:58:44 ro #include "cdio_assert.h" #include "cdio_private.h" #include "_cdio_stdio.h" +#include "portable.h" /*! Eject media -- there's nothing to do here. We always return 2. diff --git a/lib/portable.h b/lib/portable.h index 38d5d9de..fbadeb4f 100644 --- a/lib/portable.h +++ b/lib/portable.h @@ -1,5 +1,5 @@ /* - $Id: portable.h,v 1.2 2004/10/31 14:55:35 rocky Exp $ + $Id: portable.h,v 1.3 2004/11/01 09:14:21 rocky Exp $ Copyright (C) Rocky Bernstein @@ -24,6 +24,9 @@ included other routines can be more portable. */ +#ifndef __CDIO_PORTABLE_H__ +#define __CDIO_PORTABLE_H__ + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -46,3 +49,18 @@ #endif #endif /*HAVE_SNPRINTF*/ +#ifdef MSVC +#include + +#ifndef S_ISBLK +#define _S_IFBLK 0060000 /* Block Special */ +#define S_ISBLK(x) (x & _S_IFBLK) +#endif + +#ifndef S_ISCHR +#define _S_IFCHR 0020000 /* character special */ +#define S_ISCHR(x) (x & _S_IFCHR) +#endif +#endif /*MSVC*/ + +#endif /* __CDIO_PORTABLE_H__ */