"Fossies" - the Fresh Open Source Software Archive

Member "dateutils-0.4.6/build-aux/yuck-scmver.h" (19 Mar 2019, 2983 Bytes) of package /linux/privat/dateutils-0.4.6.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "yuck-scmver.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 0.4.5_vs_0.4.6.

    1 /*** yuck-version.h -- snarf versions off project cwds
    2  *
    3  * Copyright (C) 2013-2016 Sebastian Freundt
    4  *
    5  * Author:  Sebastian Freundt <freundt@ga-group.nl>
    6  *
    7  * This file is part of yuck.
    8  *
    9  * Redistribution and use in source and binary forms, with or without
   10  * modification, are permitted provided that the following conditions
   11  * are met:
   12  *
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  *
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * 3. Neither the name of the author nor the names of any contributors
   21  *    may be used to endorse or promote products derived from this
   22  *    software without specific prior written permission.
   23  *
   24  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
   25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   27  * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
   31  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   32  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
   33  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
   34  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   35  *
   36  ***/
   37 #if !defined INCLUDED_yuck_version_h_
   38 #define INCLUDED_yuck_version_h_
   39 
   40 #include "stdlib.h"
   41 
   42 typedef const struct yuck_version_s *yuck_version_t;
   43 
   44 typedef enum {
   45     YUCK_SCM_ERROR = -1,
   46     YUCK_SCM_TARBALL,
   47     YUCK_SCM_GIT,
   48     YUCK_SCM_BZR,
   49     YUCK_SCM_HG,
   50 } yuck_scm_t;
   51 
   52 struct yuck_version_s {
   53     yuck_scm_t scm;
   54     unsigned int dirty:1U;
   55     char vtag[16U];
   56     unsigned int dist;
   57     /* up to 28bits of revision id (hash for git),
   58      * the lower 4bits denote the length */
   59     unsigned int rvsn;
   60 };
   61 
   62 extern const char *const yscm_strs[];
   63 
   64 
   65 /* public api */
   66 /**
   67  * Determine SCM version of file(s) in PATH. */
   68 extern int yuck_version(struct yuck_version_s *restrict v, const char *path);
   69 
   70 /**
   71  * Read a reference file FN and return scm version information. */
   72 extern int yuck_version_read(struct yuck_version_s *restrict, const char *fn);
   73 
   74 /**
   75  * Write scm version information in V to reference file FN. */
   76 extern int yuck_version_write(const char *fn, const struct yuck_version_s *v);
   77 
   78 /**
   79  * Write scm version into buffer. */
   80 extern ssize_t yuck_version_write_fd(int fd, const struct yuck_version_s *v);
   81 
   82 /**
   83  * Compare two version objects, return <0 if V1 < V2, >0 if V1 > V2 and
   84  * 0 if V1 and V2 are considered equal. */
   85 extern int yuck_version_cmp(yuck_version_t v1, yuck_version_t v2);
   86 
   87 #endif  /* INCLUDED_yuck_version_h_ */