Harmonize source headers: C++ examples [PATCH 3/5] from pbatard.

This commit is contained in:
R. Bernstein
2012-03-03 07:42:11 -05:00
parent 422693a7cd
commit 2b84a552e3
20 changed files with 151 additions and 54 deletions

View File

@@ -21,20 +21,19 @@
libcdio. An optional drive name can be supplied as an argument. libcdio. An optional drive name can be supplied as an argument.
See also corresponding C program of a similar name. See also corresponding C program of a similar name.
*/ */
#include <cdio++/cdio.hpp>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif #endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/cdio.hpp>
/* Set up a CD-DA image to test on which is in the libcdio distribution. */ /* Set up a CD-DA image to test on which is in the libcdio distribution. */
#define CDDA_IMAGE_PATH "../../../test/" #define CDDA_IMAGE_PATH "../../../test/"

View File

@@ -20,8 +20,10 @@
/* Simple program to show drivers installed and what the default /* Simple program to show drivers installed and what the default
CD-ROM drive is. See also corresponding C program of a similar CD-ROM drive is. See also corresponding C program of a similar
name. */ name. */
#ifdef HAVE_CONFIG_H
#include <cdio++/cdio.hpp> #include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
@@ -33,6 +35,8 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/cdio.hpp>
#define _(x) x #define _(x) x
/* Prints out drive capabilities */ /* Prints out drive capabilities */

View File

@@ -17,9 +17,10 @@
/* Simple program to show drivers installed and what the default /* Simple program to show drivers installed and what the default
CD-ROM drive is and what CD drives are available. */ CD-ROM drive is and what CD drives are available. */
#include <cdio++/cdio.hpp> #ifdef HAVE_CONFIG_H
#include <cdio/cd_types.h> #include "config.h"
#include <cdio/logging.h> #define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
@@ -31,6 +32,10 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/cdio.hpp>
#include <cdio/cd_types.h>
#include <cdio/logging.h>
static void static void
log_handler (cdio_log_level_t level, const char message[]) log_handler (cdio_log_level_t level, const char message[])
{ {

View File

@@ -24,7 +24,10 @@
See also corresponding C program of a similar name. See also corresponding C program of a similar name.
*/ */
#include <cdio++/cdio.hpp> #ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
@@ -34,6 +37,8 @@
#include <string.h> #include <string.h>
#endif #endif
#include <cdio++/cdio.hpp>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {

View File

@@ -32,11 +32,14 @@
#define ISO9660_IMAGE_PATH "../../../" #define ISO9660_IMAGE_PATH "../../../"
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/isofs-m1.cue" #define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/isofs-m1.cue"
#include <sys/types.h> #ifdef HAVE_CONFIG_H
#include <cdio++/iso9660.hpp> #include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -50,6 +53,8 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/iso9660.hpp>
#define print_vd_info(title, fn) \ #define print_vd_info(title, fn) \
psz_str = p_pvd->fn(); \ psz_str = p_pvd->fn(); \
if (psz_str) { \ if (psz_str) { \

View File

@@ -29,12 +29,11 @@
#define LOCAL_FILENAME "copying" #define LOCAL_FILENAME "copying"
#include <sys/types.h>
#include <cdio++/iso9660.hpp>
#include "portable.h" #include "portable.h"
#include <stdio.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
@@ -51,6 +50,8 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/iso9660.hpp>
#define CEILING(x, y) ((x+(y-1))/y) #define CEILING(x, y) ((x+(y-1))/y)
#define my_exit(rc) \ #define my_exit(rc) \

View File

@@ -35,13 +35,8 @@
#define ISO9660_FILENAME "COPYING" #define ISO9660_FILENAME "COPYING"
#define LOCAL_FILENAME "copying" #define LOCAL_FILENAME "copying"
#include <cdio++/cdio.hpp>
#include <cdio++/iso9660.hpp>
#include "portable.h" #include "portable.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -61,6 +56,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/cdio.hpp>
#include <cdio++/iso9660.hpp>
#define CEILING(x, y) ((x+(y-1))/y) #define CEILING(x, y) ((x+(y-1))/y)
#define my_exit(rc) \ #define my_exit(rc) \

View File

@@ -34,11 +34,14 @@
#define ISO9660_IMAGE_PATH "../../../" #define ISO9660_IMAGE_PATH "../../../"
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/copying.iso" #define ISO9660_IMAGE ISO9660_IMAGE_PATH "test/copying.iso"
#include <sys/types.h> #ifdef HAVE_CONFIG_H
#include <cdio++/iso9660.hpp> #include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -52,6 +55,8 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/iso9660.hpp>
#define print_vd_info(title, fn) \ #define print_vd_info(title, fn) \
if (p_iso->fn(psz_str)) { \ if (p_iso->fn(psz_str)) { \
printf(title ": %s\n", psz_str); \ printf(title ": %s\n", psz_str); \

View File

@@ -20,8 +20,14 @@
This basically the libdio mmc_get_hwinfo() routine. This basically the libdio mmc_get_hwinfo() routine.
See also corresponding C and non OO C++ program. See also corresponding C and non OO C++ program.
*/ */
#include <cdio++/cdio.hpp> #ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@@ -29,6 +35,8 @@
#include <string.h> #include <string.h>
#endif #endif
#include <cdio++/cdio.hpp>
/* Set how long to wait for MMC commands to complete */ /* Set how long to wait for MMC commands to complete */
#define DEFAULT_TIMEOUT_MS 10000 #define DEFAULT_TIMEOUT_MS 10000

View File

@@ -19,14 +19,19 @@
from the MMC GET_CONFIGURATION command . */ from the MMC GET_CONFIGURATION command . */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif #endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPE_H #ifdef HAVE_SYS_TYPE_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#include <cdio++/cdio.hpp> #include <cdio++/cdio.hpp>
/* Set how long do wto wait for SCSI-MMC commands to complete */ /* Set how long do wto wait for SCSI-MMC commands to complete */

View File

@@ -17,11 +17,20 @@
/* Simple program to list track numbers and logical sector numbers of /* Simple program to list track numbers and logical sector numbers of
a Compact Disc using libcdio. */ a Compact Disc using libcdio. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#include <cdio++/cdio.hpp> #endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio++/cdio.hpp>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {

View File

@@ -19,8 +19,11 @@
/* Simple program to show drivers installed and what the default /* Simple program to show drivers installed and what the default
CD-ROM drive is. See also corresponding C program of a similar CD-ROM drive is. See also corresponding C program of a similar
name. */ name. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#include <cdio/cdio.h>
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
@@ -31,6 +34,8 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#define _(x) x #define _(x) x
/* Prints out drive capabilities */ /* Prints out drive capabilities */

View File

@@ -20,7 +20,11 @@
If a single argument is given, it is used as the CD-ROM device to If a single argument is given, it is used as the CD-ROM device to
eject/close. Otherwise a CD-ROM drive will be scanned for. eject/close. Otherwise a CD-ROM drive will be scanned for.
*/ */
#include <cdio/cdio.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
@@ -31,6 +35,8 @@
#include <string.h> #include <string.h>
#endif #endif
#include <cdio/cdio.h>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {

View File

@@ -29,14 +29,11 @@
#define LOCAL_FILENAME "copying" #define LOCAL_FILENAME "copying"
#include <sys/types.h>
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#include "portable.h" #include "portable.h"
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
@@ -53,6 +50,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#define CEILING(x, y) ((x+(y-1))/y) #define CEILING(x, y) ((x+(y-1))/y)
#define my_exit(rc) \ #define my_exit(rc) \

View File

@@ -29,13 +29,11 @@
#define LOCAL_FILENAME "copying" #define LOCAL_FILENAME "copying"
#include <sys/types.h>
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#include "portable.h" #include "portable.h"
#include <stdio.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
@@ -52,6 +50,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#define CEILING(x, y) ((x+(y-1))/y) #define CEILING(x, y) ((x+(y-1))/y)
#define my_exit(rc) \ #define my_exit(rc) \

View File

@@ -34,11 +34,12 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif #endif
#include <cdio/iso9660.h>
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -52,6 +53,8 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/iso9660.h>
#define print_vd_info(title, fn) \ #define print_vd_info(title, fn) \
if (fn(p_iso, &psz_str)) { \ if (fn(p_iso, &psz_str)) { \
printf(title ": %s\n", psz_str); \ printf(title ": %s\n", psz_str); \

View File

@@ -20,11 +20,26 @@
This basically the libdio mmc_get_hwinfo() routine. This basically the libdio mmc_get_hwinfo() routine.
See also corresponding C and OO C++ program. See also corresponding C and OO C++ program.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <string.h>
/* Set how long to wait for MMC commands to complete */ /* Set how long to wait for MMC commands to complete */
#define DEFAULT_TIMEOUT_MS 10000 #define DEFAULT_TIMEOUT_MS 10000

View File

@@ -17,11 +17,23 @@
/* A program to using the MMC interface to list CD and drive features /* A program to using the MMC interface to list CD and drive features
from the MMC GET_CONFIGURATION command . */ from the MMC GET_CONFIGURATION command . */
#ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <string.h>
/* Set how long do wto wait for SCSI-MMC commands to complete */ /* Set how long do wto wait for SCSI-MMC commands to complete */
#define DEFAULT_TIMEOUT_MS 10000 #define DEFAULT_TIMEOUT_MS 10000

View File

@@ -19,6 +19,10 @@
/* Simple program to show using libcdio's version of the CD-DA paranoia. /* Simple program to show using libcdio's version of the CD-DA paranoia.
library. */ library. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#include <iostream> #include <iostream>
#include <cstdlib> #include <cstdlib>
@@ -27,14 +31,15 @@
using namespace std; using namespace std;
extern "C"{ extern "C"{
#include <cdio/paranoia.h> #ifdef HAVE_STDIO_H
#include <cdio/cd_types.h>
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <cdio/paranoia.h>
#include <cdio/cd_types.h>
} }

View File

@@ -20,15 +20,21 @@
calling paranoia's open. I imagine in many cases such as media calling paranoia's open. I imagine in many cases such as media
players this may be what will be done since, one may want to get players this may be what will be done since, one may want to get
CDDB/CD-Text info beforehand. */ CDDB/CD-Text info beforehand. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#include <cdio/cdda.h> #ifdef HAVE_STDIO_H
#include <cdio/cd_types.h>
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <cdio/cdda.h>
#include <cdio/cd_types.h>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {