Subversion
svn_version.h
Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_version.h
00024  * @brief Version information.
00025  */
00026 
00027 #ifndef SVN_VERSION_H
00028 #define SVN_VERSION_H
00029 
00030 /* Hack to prevent the resource compiler from including
00031    apr_general.h.  It doesn't resolve the include paths
00032    correctly and blows up without this.
00033  */
00034 #ifndef APR_STRINGIFY
00035 #include <apr_general.h>
00036 #endif
00037 
00038 #include "svn_types.h"
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif /* __cplusplus */
00043 
00044 
00045 /* Symbols that define the version number. */
00046 
00047 /* Version numbers: <major>.<minor>.<micro>
00048  *
00049  * The version numbers in this file follow the rules established by:
00050  *
00051  *   http://apr.apache.org/versioning.html
00052  */
00053 
00054 /** Major version number.
00055  *
00056  * Modify when incompatible changes are made to published interfaces.
00057  */
00058 #define SVN_VER_MAJOR      1
00059 
00060 /** Minor version number.
00061  *
00062  * Modify when new functionality is added or new interfaces are
00063  * defined, but all changes are backward compatible.
00064  */
00065 #define SVN_VER_MINOR      7
00066 
00067 /**
00068  * Patch number.
00069  *
00070  * Modify for every released patch.
00071  *
00072  * @since New in 1.1.
00073  */
00074 #define SVN_VER_PATCH      3
00075 
00076 
00077 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00078 #define SVN_VER_MICRO      SVN_VER_PATCH
00079 
00080 /** @deprecated Provided for backward compatibility with the 1.0 API. */
00081 #define SVN_VER_LIBRARY    SVN_VER_MAJOR
00082 
00083 
00084 /** Version tag: a string describing the version.
00085  *
00086  * This tag remains " (dev build)" in the repository so that we can
00087  * always see from "svn --version" that the software has been built
00088  * from the repository rather than a "blessed" distribution.
00089  *
00090  * When rolling a tarball, we automatically replace this text with " (r1234)"
00091  * (where 1234 is the last revision on the branch prior to the release)
00092  * for final releases; in prereleases, it becomes " (Alpha 1)",
00093  * " (Beta 1)", etc., as appropriate.
00094  *
00095  * Always change this at the same time as SVN_VER_NUMTAG.
00096  */
00097 #define SVN_VER_TAG        " (under development)"
00098 
00099 
00100 /** Number tag: a string describing the version.
00101  *
00102  * This tag is used to generate a version number string to identify
00103  * the client and server in HTTP requests, for example. It must not
00104  * contain any spaces. This value remains "-dev" in the repository.
00105  *
00106  * When rolling a tarball, we automatically replace this text with ""
00107  * for final releases; in prereleases, it becomes "-alpha1, "-beta1",
00108  * etc., as appropriate.
00109  *
00110  * Always change this at the same time as SVN_VER_TAG.
00111  */
00112 #define SVN_VER_NUMTAG     "-dev"
00113 
00114 
00115 /** Revision number: The repository revision number of this release.
00116  *
00117  * This constant is used to generate the build number part of the Windows
00118  * file version. Its value remains 0 in the repository.
00119  *
00120  * When rolling a tarball, we automatically replace it with what we
00121  * guess to be the correct revision number.
00122  */
00123 #define SVN_VER_REVISION   0
00124 
00125 
00126 /* Version strings composed from the above definitions. */
00127 
00128 /** Version number */
00129 #define SVN_VER_NUM        APR_STRINGIFY(SVN_VER_MAJOR) \
00130                            "." APR_STRINGIFY(SVN_VER_MINOR) \
00131                            "." APR_STRINGIFY(SVN_VER_PATCH)
00132 
00133 /** Version number with tag (contains no whitespace) */
00134 #define SVN_VER_NUMBER     SVN_VER_NUM SVN_VER_NUMTAG
00135 
00136 /** Complete version string */
00137 #define SVN_VERSION        SVN_VER_NUMBER SVN_VER_TAG
00138 
00139 
00140 
00141 /* Version queries and compatibility checks */
00142 
00143 /**
00144  * Version information. Each library contains a function called
00145  * svn_<i>libname</i>_version() that returns a pointer to a statically
00146  * allocated object of this type.
00147  *
00148  * @since New in 1.1.
00149  */
00150 struct svn_version_t
00151 {
00152   int major;                    /**< Major version number */
00153   int minor;                    /**< Minor version number */
00154   int patch;                    /**< Patch number */
00155 
00156   /**
00157    * The version tag (#SVN_VER_NUMTAG). Must always point to a
00158    * statically allocated string.
00159    */
00160   const char *tag;
00161 };
00162 
00163 /**
00164  * Define a static svn_version_t object.
00165  *
00166  * @since New in 1.1.
00167  */
00168 #define SVN_VERSION_DEFINE(name) \
00169   static const svn_version_t name = \
00170     { \
00171       SVN_VER_MAJOR, \
00172       SVN_VER_MINOR, \
00173       SVN_VER_PATCH, \
00174       SVN_VER_NUMTAG \
00175     } \
00176 
00177 /**
00178  * Generate the implementation of a version query function.
00179  *
00180  * @since New in 1.1.
00181  */
00182 #define SVN_VERSION_BODY \
00183   SVN_VERSION_DEFINE(versioninfo);              \
00184   return &versioninfo
00185 
00186 /**
00187  * Check library version compatibility. Return #TRUE if the client's
00188  * version, given in @a my_version, is compatible with the library
00189  * version, provided in @a lib_version.
00190  *
00191  * This function checks for version compatibility as per our
00192  * guarantees, but requires an exact match when linking to an
00193  * unreleased library. A development client is always compatible with
00194  * a previous released library.
00195  *
00196  * @since New in 1.1.
00197  */
00198 svn_boolean_t
00199 svn_ver_compatible(const svn_version_t *my_version,
00200                    const svn_version_t *lib_version);
00201 
00202 /**
00203  * Check if @a my_version and @a lib_version encode the same version number.
00204  *
00205  * @since New in 1.2.
00206  */
00207 svn_boolean_t
00208 svn_ver_equal(const svn_version_t *my_version,
00209               const svn_version_t *lib_version);
00210 
00211 
00212 /**
00213  * An entry in the compatibility checklist.
00214  * @see svn_ver_check_list()
00215  *
00216  * @since New in 1.1.
00217  */
00218 typedef struct svn_version_checklist_t
00219 {
00220   const char *label;            /**< Entry label */
00221 
00222   /** Version query function for this entry */
00223   const svn_version_t *(*version_query)(void);
00224 } svn_version_checklist_t;
00225 
00226 
00227 /**
00228  * Perform a series of version compatibility checks. Checks if @a
00229  * my_version is compatible with each entry in @a checklist. @a
00230  * checklist must end with an entry whose label is @c NULL.
00231  *
00232  * @see svn_ver_compatible()
00233  *
00234  * @since New in 1.1.
00235  */
00236 svn_error_t *
00237 svn_ver_check_list(const svn_version_t *my_version,
00238                    const svn_version_checklist_t *checklist);
00239 
00240 
00241 /**
00242  * Type of function returning library version.
00243  *
00244  * @since New in 1.6.
00245  */
00246 typedef const svn_version_t *(*svn_version_func_t)(void);
00247 
00248 
00249 /* libsvn_subr doesn't have an svn_subr header, so put the prototype here. */
00250 /**
00251  * Get libsvn_subr version information.
00252  *
00253  * @since New in 1.1.
00254  */
00255 const svn_version_t *
00256 svn_subr_version(void);
00257 
00258 
00259 #ifdef __cplusplus
00260 }
00261 #endif /* __cplusplus */
00262 
00263 #endif /* SVN_VERSION_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines