include/SDL_version.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 04 Jan 2009 23:36:53 +0000
changeset 2996 972a69e47cd9
parent 2982 b64c1d23039b
child 3407 d3baf5ac4e37
permissions -rw-r--r--
Added missing void
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2009 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 
    23 /**
    24  * \file SDL_version.h
    25  *
    26  * This header defines the current SDL version
    27  */
    28 
    29 #ifndef _SDL_version_h
    30 #define _SDL_version_h
    31 
    32 #include "SDL_stdinc.h"
    33 #include "SDL_revision.h"
    34 
    35 #include "begin_code.h"
    36 /* Set up for C function definitions, even when using C++ */
    37 #ifdef __cplusplus
    38 /* *INDENT-OFF* */
    39 extern "C" {
    40 /* *INDENT-ON* */
    41 #endif
    42 
    43 /**
    44  * \struct SDL_version
    45  * \brief Information the version of SDL in use.
    46  *
    47  * Represents the library's version as three levels: major revision
    48  *  (increments with massive changes, additions, and enhancements),
    49  *  minor revision (increments with backwards-compatible changes to the
    50  *  major revision), and patchlevel (increments with fixes to the minor
    51  *  revision).
    52  *
    53  * \sa SDL_VERSION
    54  * \sa SDL_GetVersion
    55  */
    56 typedef struct SDL_version
    57 {
    58     Uint8 major;        /**< major version */
    59     Uint8 minor;        /**< minor version */
    60     Uint8 patch;        /**< update version */
    61 } SDL_version;
    62 
    63 /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
    64 */
    65 #define SDL_MAJOR_VERSION	1
    66 #define SDL_MINOR_VERSION	3
    67 #define SDL_PATCHLEVEL		0
    68 
    69 /**
    70  * \def SDL_VERSION(x)
    71  * \brief Macro to determine SDL version program was compiled against.
    72  *
    73  * This macro fills in a SDL_version structure with the version of the
    74  *  library you compiled against. This is determined by what header the
    75  *  compiler uses. Note that if you dynamically linked the library, you might
    76  *  have a slightly newer or older version at runtime. That version can be
    77  *  determined with SDL_GetVersion(), which, unlike SDL_VERSION,
    78  *  is not a macro.
    79  *
    80  * \param x A pointer to a SDL_version struct to initialize.
    81  *
    82  * \sa SDL_version
    83  * \sa SDL_GetVersion
    84  */
    85 #define SDL_VERSION(x)							\
    86 {									\
    87 	(x)->major = SDL_MAJOR_VERSION;					\
    88 	(x)->minor = SDL_MINOR_VERSION;					\
    89 	(x)->patch = SDL_PATCHLEVEL;					\
    90 }
    91 
    92 /* This macro turns the version numbers into a numeric value:
    93    (1,2,3) -> (1203)
    94    This assumes that there will never be more than 100 patchlevels
    95 */
    96 #define SDL_VERSIONNUM(X, Y, Z)						\
    97 	((X)*1000 + (Y)*100 + (Z))
    98 
    99 /* This is the version number macro for the current SDL version */
   100 #define SDL_COMPILEDVERSION \
   101 	SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
   102 
   103 /* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
   104 #define SDL_VERSION_ATLEAST(X, Y, Z) \
   105 	(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
   106 
   107 /**
   108  * \fn void SDL_GetVersion(SDL_version *ver)
   109  * \brief Get the version of SDL that is linked against your program.
   110  *
   111  * If you are using a shared library (DLL) version of SDL, then it is
   112  *  possible that it will be different than the version you compiled against.
   113  *
   114  * This is a real function; the macro SDL_VERSION tells you what version
   115  *  of SDL you compiled against:
   116  *
   117  * \code
   118  * SDL_version compiled;
   119  * SDL_version linked;
   120  *
   121  * SDL_VERSION(&compiled);
   122  * SDL_GetVersion(&linked);
   123  * printf("We compiled against SDL version %d.%d.%d ...\n",
   124  *           compiled.major, compiled.minor, compiled.patch);
   125  * printf("But we linked against SDL version %d.%d.%d.\n",
   126  *           linked.major, linked.minor, linked.patch);
   127  * \endcode
   128  *
   129  * This function may be called safely at any time, even before SDL_Init().
   130  *
   131  * \sa SDL_VERSION
   132  */
   133 extern DECLSPEC void SDLCALL SDL_GetVersion(SDL_version * ver);
   134 
   135 /**
   136  * \fn int SDL_GetRevision(void)
   137  * \brief Get the code revision of SDL that is linked against your program.
   138  */
   139 extern DECLSPEC int SDLCALL SDL_GetRevision(void);
   140 
   141 /* Ends C function definitions when using C++ */
   142 #ifdef __cplusplus
   143 /* *INDENT-OFF* */
   144 }
   145 /* *INDENT-ON* */
   146 #endif
   147 #include "close_code.h"
   148 
   149 #endif /* _SDL_version_h */
   150 
   151 /* vi: set ts=4 sw=4 expandtab: */