include/SDL_version.h
branchSDL-1.3
changeset 1662 782fd950bd46
parent 1654 0a53c90a37f9
child 1668 4da1ee79c9af
     1.1 --- a/include/SDL_version.h	Sun May 21 17:27:13 2006 +0000
     1.2 +++ b/include/SDL_version.h	Sun May 28 13:04:16 2006 +0000
     1.3 @@ -20,7 +20,11 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  
     1.7 -/* This header defines the current SDL version */
     1.8 +/**
     1.9 + * \file SDL_version.h
    1.10 + *
    1.11 + * This header defines the current SDL version
    1.12 + */
    1.13  
    1.14  #ifndef _SDL_version_h
    1.15  #define _SDL_version_h
    1.16 @@ -30,29 +34,58 @@
    1.17  #include "begin_code.h"
    1.18  /* Set up for C function definitions, even when using C++ */
    1.19  #ifdef __cplusplus
    1.20 +/* *INDENT-OFF* */
    1.21  extern "C" {
    1.22 +/* *INDENT-ON* */
    1.23  #endif
    1.24  
    1.25 +/**
    1.26 + * \struct SDL_version
    1.27 + * \brief Information the version of SDL in use.
    1.28 + *
    1.29 + * Represents the library's version as three levels: major revision
    1.30 + *  (increments with massive changes, additions, and enhancements),
    1.31 + *  minor revision (increments with backwards-compatible changes to the
    1.32 + *  major revision), and patchlevel (increments with fixes to the minor
    1.33 + *  revision).
    1.34 + *
    1.35 + * \sa SDL_VERSION
    1.36 + * \sa SDL_GetVersion
    1.37 + */
    1.38 +typedef struct SDL_version
    1.39 +{
    1.40 +    Uint8 major;        /**< major version */
    1.41 +    Uint8 minor;        /**< minor version */
    1.42 +    Uint8 patch;        /**< update version */
    1.43 +} SDL_version;
    1.44 +
    1.45  /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
    1.46  */
    1.47  #define SDL_MAJOR_VERSION	1
    1.48  #define SDL_MINOR_VERSION	3
    1.49  #define SDL_PATCHLEVEL		0
    1.50  
    1.51 -typedef struct SDL_version {
    1.52 -	Uint8 major;
    1.53 -	Uint8 minor;
    1.54 -	Uint8 patch;
    1.55 -} SDL_version;
    1.56 -
    1.57 -/* This macro can be used to fill a version structure with the compile-time
    1.58 - * version of the SDL library.
    1.59 +/**
    1.60 + * \def SDL_VERSION(x)
    1.61 + * \brief Macro to determine SDL version program was compiled against.
    1.62 + *
    1.63 + * This macro fills in a SDL_version structure with the version of the
    1.64 + *  library you compiled against. This is determined by what header the
    1.65 + *  compiler uses. Note that if you dynamically linked the library, you might
    1.66 + *  have a slightly newer or older version at runtime. That version can be
    1.67 + *  determined with SDL_GetVersion(), which, unlike SDL_VERSION,
    1.68 + *  is not a macro.
    1.69 + *
    1.70 + * \param x A pointer to a SDL_version struct to initialize.
    1.71 + *
    1.72 + * \sa SDL_version
    1.73 + * \sa SDL_GetVersion
    1.74   */
    1.75 -#define SDL_VERSION(X)							\
    1.76 +#define SDL_VERSION(x)							\
    1.77  {									\
    1.78 -	(X)->major = SDL_MAJOR_VERSION;					\
    1.79 -	(X)->minor = SDL_MINOR_VERSION;					\
    1.80 -	(X)->patch = SDL_PATCHLEVEL;					\
    1.81 +	(x)->major = SDL_MAJOR_VERSION;					\
    1.82 +	(x)->minor = SDL_MINOR_VERSION;					\
    1.83 +	(x)->patch = SDL_PATCHLEVEL;					\
    1.84  }
    1.85  
    1.86  /* This macro turns the version numbers into a numeric value:
    1.87 @@ -70,16 +103,42 @@
    1.88  #define SDL_VERSION_ATLEAST(X, Y, Z) \
    1.89  	(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
    1.90  
    1.91 -/* This function gets the version of the dynamically linked SDL library.
    1.92 -   it should NOT be used to fill a version structure, instead you should
    1.93 -   use the SDL_Version() macro.
    1.94 +/**
    1.95 + * \fn void SDL_GetVersion(SDL_version *ver)
    1.96 + * \brief Get the version of SDL that is linked against your program.
    1.97 + *
    1.98 + * If you are using a shared library (DLL) version of SDL, then it is
    1.99 + *  possible that it will be different than the version you compiled against.
   1.100 + *
   1.101 + * This is a real function; the macro SDL_VERSION tells you what version
   1.102 + *  of SDL you compiled against:
   1.103 + *
   1.104 + * \code
   1.105 + * SDL_version compiled;
   1.106 + * SDL_version linked;
   1.107 + *
   1.108 + * SDL_VERSION(&compiled);
   1.109 + * SDL_GetVersion(&linked);
   1.110 + * printf("We compiled against SDL version %d.%d.%d ...\n",
   1.111 + *           compiled.major, compiled.minor, compiled.patch);
   1.112 + * printf("But we linked against SDL version %d.%d.%d.\n",
   1.113 + *           linked.major, linked.minor, linked.patch);
   1.114 + * \endcode
   1.115 + *
   1.116 + * This function may be called safely at any time, even before SDL_Init().
   1.117 + *
   1.118 + * \sa SDL_VERSION
   1.119   */
   1.120 -extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
   1.121 +extern DECLSPEC void SDLCALL SDL_GetVersion (SDL_version * ver);
   1.122  
   1.123  /* Ends C function definitions when using C++ */
   1.124  #ifdef __cplusplus
   1.125 +/* *INDENT-OFF* */
   1.126  }
   1.127 +/* *INDENT-ON* */
   1.128  #endif
   1.129  #include "close_code.h"
   1.130  
   1.131  #endif /* _SDL_version_h */
   1.132 +
   1.133 +/* vi: set ts=4 sw=4 expandtab: */