aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile.am24
-rw-r--r--configure.ac7
-rw-r--r--dmstools.xcodeproj/project.pbxproj6
-rw-r--r--include/dms.h19
-rw-r--r--include/dmsversion.h.in48
-rw-r--r--lib/libdms.sym6
-rw-r--r--lib/libdms_version.c53
-rw-r--r--src/dmsversion.c10
8 files changed, 165 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index a2e7189..e6bec2f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,14 +33,14 @@ AM_LDFLAGS = @LTLIBINTL@
33AM_CFLAGS = -O2 -W -Wall -Werror 33AM_CFLAGS = -O2 -W -Wall -Werror
34AM_CXXFLAGS = -O2 -W -Wall -Werror 34AM_CXXFLAGS = -O2 -W -Wall -Werror
35AM_OBJCFLAGS = -O2 -W -Wall -Werror 35AM_OBJCFLAGS = -O2 -W -Wall -Werror
36AM_CPPFLAGS = -O2 -W -Wall -Werror -DHAVE_COMMON_H=1 -I$(top_srcdir)/include 36AM_CPPFLAGS = -O2 -W -Wall -Werror -DHAVE_COMMON_H=1 -I$(top_builddir)/include -I$(top_srcdir)/include
37ACLOCAL_AMFLAGS = -I m4 37ACLOCAL_AMFLAGS = -I m4
38DEFS = -DLOCALEDIR="\"$(localedir)\"" @DEFS@ 38DEFS = -DLOCALEDIR="\"$(localedir)\"" @DEFS@
39 39
40 40
41# automake targets 41# automake targets
42bin_PROGRAMS = src/bindump src/bitcopy src/bitops src/dmsversion src/numconvert src/typedef-info 42bin_PROGRAMS = src/bindump src/bitcopy src/bitops src/dmsversion src/numconvert src/typedef-info
43include_HEADERS = include/dms.h 43include_HEADERS = include/dms.h include/dmsversion.h
44lib_LTLIBRARIES = lib/libdms.la 44lib_LTLIBRARIES = lib/libdms.la
45noinst_PROGRAMS = 45noinst_PROGRAMS =
46noinst_HEADERS = src/common.h 46noinst_HEADERS = src/common.h
@@ -57,6 +57,7 @@ lib_libdms_la_LDFLAGS = -rpath '$(libdir)' \
57 -pthread \ 57 -pthread \
58 -export-symbols $(srcdir)/lib/libdms.sym 58 -export-symbols $(srcdir)/lib/libdms.sym
59lib_libdms_la_SOURCES = include/dms.h \ 59lib_libdms_la_SOURCES = include/dms.h \
60 include/dmsversion.h \
60 lib/libdms.h \ 61 lib/libdms.h \
61 lib/libdms_version.c \ 62 lib/libdms_version.c \
62 lib/libdms_version.h 63 lib/libdms_version.h
@@ -141,10 +142,12 @@ src_typedef_info_SOURCES = $(noinst_HEADERS) \
141 142
142 143
143# lists 144# lists
145BUILT_SOURCES = include/dmsversion.h
144TESTS = 146TESTS =
145XFAIL_TESTS = 147XFAIL_TESTS =
146EXTRA_DIST = build-aux/config.rpath \ 148EXTRA_DIST = build-aux/config.rpath \
147 build-aux/git-package-version \ 149 build-aux/git-package-version \
150 include/dmsversion.h.in \
148 include/gettext.h \ 151 include/gettext.h \
149 lib/libdms.sym \ 152 lib/libdms.sym \
150 $(srcdir)/dmstools.tags \ 153 $(srcdir)/dmstools.tags \
@@ -164,6 +167,7 @@ CLEANFILES = \
164 $(builddir)/*/a.out $(srcdir)/*/a.out \ 167 $(builddir)/*/a.out $(srcdir)/*/a.out \
165 config.h.in~ $(srcdir)/config.h.in~ \ 168 config.h.in~ $(srcdir)/config.h.in~ \
166 $(man_MANS) \ 169 $(man_MANS) \
170 include/dmsversion.h \
167 @PACKAGE_TARNAME@-*.tar.* \ 171 @PACKAGE_TARNAME@-*.tar.* \
168 @PACKAGE_TARNAME@-*.zip 172 @PACKAGE_TARNAME@-*.zip
169 173
@@ -176,12 +180,22 @@ do_subst = sed \
176 -e 's,[@]PACKAGE_TARNAME[@],@PACKAGE_TARNAME@,g' \ 180 -e 's,[@]PACKAGE_TARNAME[@],@PACKAGE_TARNAME@,g' \
177 -e 's,[@]PACKAGE_BUGREPORT[@],@PACKAGE_BUGREPORT@,g' \ 181 -e 's,[@]PACKAGE_BUGREPORT[@],@PACKAGE_BUGREPORT@,g' \
178 -e 's|[@]PACKAGE_COPYRIGHT[@]|@PACKAGE_COPYRIGHT@|g' \ 182 -e 's|[@]PACKAGE_COPYRIGHT[@]|@PACKAGE_COPYRIGHT@|g' \
183 -e 's,[@]LIB_VERSION_CURRENT[@],@LIB_VERSION_CURRENT@,g' \
184 -e 's,[@]LIB_VERSION_REVISION[@],@LIB_VERSION_REVISION@,g' \
185 -e 's,[@]LIB_VERSION_AGE[@],@LIB_VERSION_AGE@,g' \
186 -e 's,[@]LIB_VERSION_INFO[@],@LIB_VERSION_INFO@,g' \
187 -e 's,[@]LIB_RELEASE_INFO[@],@LIB_RELEASE_INFO@,g' \
179 -e 's,[@]RELEASE_MONTH[@],@RELEASE_MONTH@,g' 188 -e 's,[@]RELEASE_MONTH[@],@RELEASE_MONTH@,g'
180do_subst_fn = \ 189do_subst_fn = \
181 echo "do_subst < ${@}.in > ${@}"; \ 190 echo "do_subst < ${@}.in > ${@}"; \
182 mkdir -p `dirname ${@}` || exit 1; \ 191 mkdir -p `dirname ${@}` || exit 1; \
183 ${do_subst} < $(srcdir)/${@}.in > ${@} || exit 1; \ 192 ${do_subst} < $(srcdir)/${@}.in > ${@} || exit 1; \
184 chmod 0755 ${@} 193 chmod 0755 ${@}
194do_subst_dt = \
195 echo "do_subst < ${@}.in > ${@}"; \
196 mkdir -p `dirname ${@}` || exit 1; \
197 ${do_subst} < $(srcdir)/${@}.in > ${@} || exit 1; \
198 chmod 0644 ${@}
185 199
186 200
187# custom targets 201# custom targets
@@ -203,7 +217,11 @@ build-aux/git-package-version:
203 $(top_builddir)/config.status --recheck 217 $(top_builddir)/config.status --recheck
204 218
205doc/codetagger.1: Makefile $(srcdir)/doc/codetagger.1.in 219doc/codetagger.1: Makefile $(srcdir)/doc/codetagger.1.in
206 @$(do_subst_fn) 220 @$(do_subst_dt)
221
222include/dmsversion.h: Makefile $(srcdir)/include/dmsversion.h.in
223 $(mkdir_p) include
224 @$(do_subst_dt)
207 225
208license-tags: $(srcdir)/dmstools.tags $(builddir)/src/codetagger 226license-tags: $(srcdir)/dmstools.tags $(builddir)/src/codetagger
209 $(builddir)/src/codetagger -f $(srcdir)/dmstools.tags $(srcdir)/AUTHORS 227 $(builddir)/src/codetagger -f $(srcdir)/dmstools.tags $(srcdir)/AUTHORS
diff --git a/configure.ac b/configure.ac
index 57319e1..1186cf4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,8 +38,11 @@ AC_DEFINE_UNQUOTED(PACKAGE_COPYRIGHT, ["$PACKAGE_COPYRIGHT"], ["Copyright info"]
38# Age -- How many seqential past API versions is supported by 38# Age -- How many seqential past API versions is supported by
39# this implementation 39# this implementation
40# Format => Current:Revision:Age 40# Format => Current:Revision:Age
41AC_SUBST(LIB_VERSION_INFO, 2:1:1) 41AC_SUBST([LIB_VERSION_CURRENT], [0])
42AC_SUBST(LIB_RELEASE_INFO, 2) # used by Win32 DLLs 42AC_SUBST([LIB_VERSION_REVISION], [0])
43AC_SUBST([LIB_VERSION_AGE], [0])
44AC_SUBST([LIB_VERSION_INFO], [${LIB_VERSION_CURRENT}:${LIB_VERSION_REVISION}:${LIB_VERSION_AGE}])
45AC_SUBST([LIB_RELEASE_INFO], [${LIB_VERSION_CURRENT}]) # used by Win32 DLLs
43 46
44AC_CONFIG_AUX_DIR([build-aux]) 47AC_CONFIG_AUX_DIR([build-aux])
45AC_CONFIG_SRCDIR([dmstools.tags]) 48AC_CONFIG_SRCDIR([dmstools.tags])
diff --git a/dmstools.xcodeproj/project.pbxproj b/dmstools.xcodeproj/project.pbxproj
index 368e3ad..afb91c5 100644
--- a/dmstools.xcodeproj/project.pbxproj
+++ b/dmstools.xcodeproj/project.pbxproj
@@ -30,9 +30,11 @@
30 A07BC6F10F0210CF00219629 /* bitops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitops.c; sourceTree = "<group>"; }; 30 A07BC6F10F0210CF00219629 /* bitops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitops.c; sourceTree = "<group>"; };
31 A08B43A010FCD1580091D7C8 /* dms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dms.h; sourceTree = "<group>"; }; 31 A08B43A010FCD1580091D7C8 /* dms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dms.h; sourceTree = "<group>"; };
32 A08B43A310FCD1670091D7C8 /* libdms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libdms.h; sourceTree = "<group>"; }; 32 A08B43A310FCD1670091D7C8 /* libdms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libdms.h; sourceTree = "<group>"; };
33 A08B43A410FCD1670091D7C8 /* libdms.sym */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = libdms.sym; sourceTree = "<group>"; }; 33 A08B43A410FCD1670091D7C8 /* libdms.sym */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = libdms.sym; sourceTree = "<group>"; };
34 A08B43A710FCD1670091D7C8 /* libdms_version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = libdms_version.c; sourceTree = "<group>"; }; 34 A08B43A710FCD1670091D7C8 /* libdms_version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = libdms_version.c; sourceTree = "<group>"; };
35 A08B43A810FCD1670091D7C8 /* libdms_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libdms_version.h; sourceTree = "<group>"; }; 35 A08B43A810FCD1670091D7C8 /* libdms_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libdms_version.h; sourceTree = "<group>"; };
36 A08B43AD10FCD73F0091D7C8 /* dmsversion.h.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.c; fileEncoding = 4; path = dmsversion.h.in; sourceTree = "<group>"; };
37 A08B43D110FD0B280091D7C8 /* dmsversion.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dmsversion.c; sourceTree = "<group>"; };
36 A0AE375510EAAA3C006B1ADB /* typedef-info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "typedef-info.c"; sourceTree = "<group>"; }; 38 A0AE375510EAAA3C006B1ADB /* typedef-info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "typedef-info.c"; sourceTree = "<group>"; };
37 A0AF031210F540EB00CBC28C /* bindump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bindump.c; sourceTree = "<group>"; }; 39 A0AF031210F540EB00CBC28C /* bindump.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bindump.c; sourceTree = "<group>"; };
38 A0B6D45D1033A3BA004E87EE /* numconvert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = numconvert.c; sourceTree = "<group>"; }; 40 A0B6D45D1033A3BA004E87EE /* numconvert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = numconvert.c; sourceTree = "<group>"; };
@@ -75,6 +77,7 @@
75 A07BC6F10F0210CF00219629 /* bitops.c */, 77 A07BC6F10F0210CF00219629 /* bitops.c */,
76 A004228B0E0E3C4200B0ED60 /* codetagger.c */, 78 A004228B0E0E3C4200B0ED60 /* codetagger.c */,
77 A004228C0E0E3C4200B0ED60 /* common.h */, 79 A004228C0E0E3C4200B0ED60 /* common.h */,
80 A08B43D110FD0B280091D7C8 /* dmsversion.c */,
78 A0B6D45D1033A3BA004E87EE /* numconvert.c */, 81 A0B6D45D1033A3BA004E87EE /* numconvert.c */,
79 A004228D0E0E3C4200B0ED60 /* posixregex.c */, 82 A004228D0E0E3C4200B0ED60 /* posixregex.c */,
80 A007E66F0EB09C51008A1261 /* recurse.c */, 83 A007E66F0EB09C51008A1261 /* recurse.c */,
@@ -104,6 +107,7 @@
104 isa = PBXGroup; 107 isa = PBXGroup;
105 children = ( 108 children = (
106 A08B43A010FCD1580091D7C8 /* dms.h */, 109 A08B43A010FCD1580091D7C8 /* dms.h */,
110 A08B43AD10FCD73F0091D7C8 /* dmsversion.h.in */,
107 ); 111 );
108 path = include; 112 path = include;
109 sourceTree = "<group>"; 113 sourceTree = "<group>";
diff --git a/include/dms.h b/include/dms.h
index 1c9a5dd..2aa3374 100644
--- a/include/dms.h
+++ b/include/dms.h
@@ -106,6 +106,7 @@
106/////////////// 106///////////////
107 107
108#include <inttypes.h> 108#include <inttypes.h>
109#include <dmsversion.h>
109 110
110 111
111/////////////////// 112///////////////////
@@ -134,6 +135,24 @@
134////////////////// 135//////////////////
135BEGIN_C_DECLS 136BEGIN_C_DECLS
136 137
138// returns the binary GNU Libtool LIB_VERSION_INFO value
139DMS_F(int) dms_lib_version PARAMS((void));
140
141// returns the GNU Libtool LIB_VERSION_AGE value
142DMS_F(int) dms_lib_version_age PARAMS((void));
143
144// checks for library binary compatability
145DMS_F(int) dms_lib_version_check PARAMS((int version));
146
147// returns the GNU Libtool LIB_VERSION_CURRENT value
148DMS_F(int) dms_lib_version_current PARAMS((void));
149
150// returns the GNU Libtool LIB_VERSION_INFO string
151DMS_F(const char *) dms_lib_version_info PARAMS((void));
152
153// returns the GNU Libtool LIB_VERSION_REVISION value
154DMS_F(int) dms_lib_version_revision PARAMS((void));
155
137// returns version info string for library 156// returns version info string for library
138DMS_F(const char *) dms_version PARAMS((void)); 157DMS_F(const char *) dms_version PARAMS((void));
139 158
diff --git a/include/dmsversion.h.in b/include/dmsversion.h.in
new file mode 100644
index 0000000..646d547
--- /dev/null
+++ b/include/dmsversion.h.in
@@ -0,0 +1,48 @@
1/*
2 * DMS Tools and Utilities
3 * Copyright (C) 2010 David M. Syzdek <david@syzdek.net>.
4 *
5 * @SYZDEK_LICENSE_HEADER_START@
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License Version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * @SYZDEK_LICENSE_HEADER_END@
21 */
22/**
23 * @file lib/dms.h defines API for libdms.la
24 */
25#ifndef _DMSVERSION_H
26#define _DMSVERSION_H 1
27
28///////////////////
29// //
30// Definitions //
31// //
32///////////////////
33
34// Module Version Info (similar to libtool's library version)
35// Current -- the current version number of this API
36// Revision -- the software revision of this API version
37// Age -- How many seqential past API versions is supported by
38// this API version
39#define DMS_LIB_VERSION_CURRENT @LIB_VERSION_CURRENT@
40#define DMS_LIB_VERSION_REVISION @LIB_VERSION_REVISION@
41#define DMS_LIB_VERSION_AGE @LIB_VERSION_AGE@
42#define DMS_LIB_VERSION_INFO "@LIB_VERSION_INFO@"
43#define DMS_LIB_VERSION ( ((@LIB_VERSION_CURRENT@ & 0xFFFF) << 16) | \
44 ((@LIB_VERSION_REVISION@ & 0xFF) << 8) | \
45 (@LIB_VERSION_AGE@ & 0xFF) )
46
47
48#endif /* end of header file */
diff --git a/lib/libdms.sym b/lib/libdms.sym
index 5334bd1..65aa576 100644
--- a/lib/libdms.sym
+++ b/lib/libdms.sym
@@ -38,5 +38,11 @@
38# Clean: 38# Clean:
39# libtool --mode=clean rm -f libdms.la libdms_version.lo 39# libtool --mode=clean rm -f libdms.la libdms_version.lo
40# 40#
41dms_lib_version
42dms_lib_version_age
43dms_lib_version_check
44dms_lib_version_current
45dms_lib_version_info
46dms_lib_version_revision
41dms_version 47dms_version
42# end of symbol export file 48# end of symbol export file
diff --git a/lib/libdms_version.c b/lib/libdms_version.c
index 1ce7745..19c8663 100644
--- a/lib/libdms_version.c
+++ b/lib/libdms_version.c
@@ -40,10 +40,61 @@
40// // 40// //
41///////////////// 41/////////////////
42 42
43/// returns the binary GNU Libtool LIB_VERSION_INFO value
44int dms_lib_version(void)
45{
46 return(DMS_LIB_VERSION);
47}
48
49
50/// returns the GNU Libtool LIB_VERSION_AGE value
51int dms_lib_version_age(void)
52{
53 return(DMS_LIB_VERSION_AGE);
54}
55
56
57/// checks for library binary compatability
58/// @param[in] info version info to compare
59int dms_lib_version_check(int version)
60{
61 int lib_cur = ((DMS_LIB_VERSION_CURRENT >> 16) & 0xFFFF);
62 int lib_age = ((DMS_LIB_VERSION_AGE >> 0) & 0xFF);
63 int ver_cur = ((version >> 16) & 0xFFFF);
64 int ver_age = ((version >> 0) & 0xFF);
65 if (ver_cur < (lib_cur-lib_age))
66 return(1);
67 if (lib_cur < (ver_cur-ver_age))
68 return(1);
69 return(0);
70}
71
72
73/// returns the GNU Libtool LIB_VERSION_CURRENT value
74int dms_lib_version_current(void)
75{
76 return(DMS_LIB_VERSION_CURRENT);
77}
78
79
80/// returns the GNU Libtool LIB_VERSION_INFO string
81const char * dms_lib_version_info(void)
82{
83 return(DMS_LIB_VERSION_INFO);
84}
85
86
87/// returns the GNU Libtool LIB_VERSION_REVISION value
88int dms_lib_version_revision(void)
89{
90 return(DMS_LIB_VERSION_REVISION);
91}
92
93
43/// returns version info string for library 94/// returns version info string for library
44const char * dms_version(void) 95const char * dms_version(void)
45{ 96{
46 return("libdms.la (" PACKAGE_NAME ") " PACKAGE_VERSION); 97 return("libdms.la (" PACKAGE_NAME ") " DMS_LIB_VERSION_INFO);
47} 98}
48 99
49/* end of source code */ 100/* end of source code */
diff --git a/src/dmsversion.c b/src/dmsversion.c
index d95eaab..865a984 100644
--- a/src/dmsversion.c
+++ b/src/dmsversion.c
@@ -123,7 +123,15 @@ int main(int argc, char * argv[])
123{ 123{
124 if (argc == -1) 124 if (argc == -1)
125 printf("%s\n", argv[0]); 125 printf("%s\n", argv[0]);
126 printf("%s\n", dms_version()); 126 printf(_("%s (%s) %s\n"
127 "%s\n"
128 "Written by David M. Syzdek\n"
129 "\n"
130 "Copyright (C) 2010 David M. Syzdek\n"
131 "This is free software; see the source for copying conditions. There is NO\n"
132 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
133 ), PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION, dms_version()
134 );
127 return(0); 135 return(0);
128} 136}
129 137