aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2010-01-11 23:13:06 -0900
committerDavid M. Syzdek <david@syzdek.net>2010-01-11 23:13:06 -0900
commit6aae7060409b66dd0d4a3b614309ca11ca50c8ea (patch)
tree6248d056732ea8073de968ce2fd7eb40819d9db2
parentc25baa56b90792995c37efa1d09598bb90c0ea22 (diff)
downloaddmstools-6aae7060409b66dd0d4a3b614309ca11ca50c8ea.tar.gz
dmstools-6aae7060409b66dd0d4a3b614309ca11ca50c8ea.tar.bz2
dmstools-6aae7060409b66dd0d4a3b614309ca11ca50c8ea.tar.xz
dmstools-6aae7060409b66dd0d4a3b614309ca11ca50c8ea.zip
Starting libdms.la
-rw-r--r--Makefile.am30
-rw-r--r--include/dms.h142
-rw-r--r--lib/libdms.h87
-rw-r--r--lib/libdms.sym42
-rw-r--r--lib/libdms_version.c49
-rw-r--r--lib/libdms_version.h28
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/dmsversion.c130
8 files changed, 509 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 1cc1bc1..a2e7189 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,17 +39,36 @@ DEFS = -DLOCALEDIR="\"$(localedir)\"" @DEFS@
39 39
40 40
41# automake targets 41# automake targets
42bin_PROGRAMS = src/bindump src/bitcopy src/bitops 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
44lib_LTLIBRARIES = lib/libdms.la
43noinst_PROGRAMS = 45noinst_PROGRAMS =
44noinst_HEADERS = src/common.h 46noinst_HEADERS = src/common.h
45man_MANS = doc/codetagger.1 47man_MANS = doc/codetagger.1
46 48
49
50# macros for lib/libotadm.la
51lib_libdms_la_DEPENDENCIES = Makefile lib/libdms.sym
52lib_libdms_la_CFLAGS = $(AM_CFLAGS)
53lib_libdms_la_LIBADD = $(AM_LIBS)
54lib_libdms_la_LDFLAGS = -rpath '$(libdir)' \
55 -version-info $(LIB_VERSION_INFO) \
56 $(AM_LDFLAGS) \
57 -pthread \
58 -export-symbols $(srcdir)/lib/libdms.sym
59lib_libdms_la_SOURCES = include/dms.h \
60 lib/libdms.h \
61 lib/libdms_version.c \
62 lib/libdms_version.h
63
64
47# macros for src/bindump 65# macros for src/bindump
48src_bindump_DEPENDENCIES = $(lib_LTLIBRARIES) Makefile 66src_bindump_DEPENDENCIES = $(lib_LTLIBRARIES) Makefile
49src_bindump_CPPFLAGS = -DPROGRAM_NAME="\"bindump\"" $(AM_CPPFLAGS) 67src_bindump_CPPFLAGS = -DPROGRAM_NAME="\"bindump\"" $(AM_CPPFLAGS)
50src_bindump_SOURCES = $(noinst_HEADERS) \ 68src_bindump_SOURCES = $(noinst_HEADERS) \
51 src/bindump.c 69 src/bindump.c
52 70
71
53# macros for src/bitops 72# macros for src/bitops
54src_bitcopy_DEPENDENCIES = $(lib_LTLIBRARIES) Makefile 73src_bitcopy_DEPENDENCIES = $(lib_LTLIBRARIES) Makefile
55src_bitcopy_CPPFLAGS = -DPROGRAM_NAME="\"bitcopy\"" $(AM_CPPFLAGS) 74src_bitcopy_CPPFLAGS = -DPROGRAM_NAME="\"bitcopy\"" $(AM_CPPFLAGS)
@@ -74,6 +93,14 @@ bin_PROGRAMS += src/codetagger
74endif 93endif
75 94
76 95
96# macros for src/dmsversion
97src_dmsversion_DEPENDENCIES = $(lib_LTLIBRARIES) Makefile
98src_dmsversion_CPPFLAGS = -DPROGRAM_NAME="\"dmsversion\"" $(AM_CPPFLAGS)
99src_dmsversion_LDADD = $(AM_LDADD) lib/libdms.la
100src_dmsversion_SOURCES = $(noinst_HEADERS) \
101 src/dmsversion.c
102
103
77# macros for src/numconvert 104# macros for src/numconvert
78src_numconvert_DEPENDENCIES = $(lib_LTLIBRARIES) Makefile 105src_numconvert_DEPENDENCIES = $(lib_LTLIBRARIES) Makefile
79src_numconvert_CPPFLAGS = -DPROGRAM_NAME="\"numconvert\"" $(AM_CPPFLAGS) 106src_numconvert_CPPFLAGS = -DPROGRAM_NAME="\"numconvert\"" $(AM_CPPFLAGS)
@@ -119,6 +146,7 @@ XFAIL_TESTS =
119EXTRA_DIST = build-aux/config.rpath \ 146EXTRA_DIST = build-aux/config.rpath \
120 build-aux/git-package-version \ 147 build-aux/git-package-version \
121 include/gettext.h \ 148 include/gettext.h \
149 lib/libdms.sym \
122 $(srcdir)/dmstools.tags \ 150 $(srcdir)/dmstools.tags \
123 $(srcdir)/doc/Doxyfile \ 151 $(srcdir)/doc/Doxyfile \
124 $(srcdir)/doc/codetagger.1.in \ 152 $(srcdir)/doc/codetagger.1.in \
diff --git a/include/dms.h b/include/dms.h
new file mode 100644
index 0000000..1c9a5dd
--- /dev/null
+++ b/include/dms.h
@@ -0,0 +1,142 @@
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 _DMS_H
26#define _DMS_H 1
27
28//////////////
29// //
30// Macros //
31// //
32//////////////
33
34/*
35 * The macros "BEGIN_C_DECLS" and "END_C_DECLS" are taken verbatim
36 * from section 7.1 of the Libtool 1.5.14 manual.
37 */
38/* BEGIN_C_DECLS should be used at the beginning of your declarations,
39 so that C++ compilers don't mangle their names. Use END_C_DECLS at
40 the end of C declarations. */
41#undef BEGIN_C_DECLS
42#undef END_C_DECLS
43#if defined(__cplusplus) || defined(c_plusplus)
44# define BEGIN_C_DECLS extern "C" { ///< exports as C functions
45# define END_C_DECLS } ///< exports as C functions
46#else
47# define BEGIN_C_DECLS /* empty */ ///< exports as C functions
48# define END_C_DECLS /* empty */ ///< exports as C functions
49#endif
50
51
52/*
53 * The macro "PARAMS" is taken verbatim from section 7.1 of the
54 * Libtool 1.5.14 manual.
55 */
56/* PARAMS is a macro used to wrap function prototypes, so that
57 compilers that don't understand ANSI C prototypes still work,
58 and ANSI C compilers can issue warnings about type mismatches. */
59#undef PARAMS
60#if defined (__STDC__) || defined (_AIX) \
61 || (defined (__mips) && defined (_SYSTYPE_SVR4)) \
62 || defined(WIN32) || defined (__cplusplus)
63# define PARAMS(protos) protos ///< wraps function arguments in order to support ANSI C
64#else
65# define PARAMS(protos) () ///< wraps function arguments in order to support ANSI C
66#endif
67
68
69/*
70 * The following macro is taken verbatim from section 5.40 of the GCC
71 * 4.0.2 manual.
72 */
73#if __STDC_VERSION__ < 199901L
74# if __GNUC__ >= 2
75# define __func__ __FUNCTION__
76# else
77# define __func__ "<unknown>"
78# endif
79#endif
80
81
82// Exports function type
83#ifdef WIN32
84# ifdef DMS_LIBS_DYNAMIC
85# define DMS_F(type) extern __declspec(dllexport) type ///< used for library calls
86# define DMS_V(type) extern __declspec(dllexport) type ///< used for library calls
87# else
88# define DMS_F(type) extern __declspec(dllimport) type ///< used for library calls
89# define DMS_V(type) extern __declspec(dllimport) type ///< used for library calls
90# endif
91#else
92# ifdef DMS_LIBS_DYNAMIC
93# define DMS_F(type) type ///< used for library calls
94# define DMS_V(type) type ///< used for library calls
95# else
96# define DMS_F(type) extern type ///< used for library calls
97# define DMS_V(type) extern type ///< used for library calls
98# endif
99#endif
100
101
102///////////////
103// //
104// Headers //
105// //
106///////////////
107
108#include <inttypes.h>
109
110
111///////////////////
112// //
113// Definitions //
114// //
115///////////////////
116
117#define DMS_TRUE 0x01
118#define DMS_FALSE 0x00
119#define DMS_YES 0x01
120#define DMS_NO 0x00
121
122
123/////////////////
124// //
125// Datatypes //
126// //
127/////////////////
128
129
130//////////////////
131// //
132// Prototypes //
133// //
134//////////////////
135BEGIN_C_DECLS
136
137// returns version info string for library
138DMS_F(const char *) dms_version PARAMS((void));
139
140
141END_C_DECLS
142#endif /* end of header file */ \ No newline at end of file
diff --git a/lib/libdms.h b/lib/libdms.h
new file mode 100644
index 0000000..e1a7ea0
--- /dev/null
+++ b/lib/libdms.h
@@ -0,0 +1,87 @@
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/libdms.h internal directives for libdms.la
24 */
25#ifndef _OTADM_LIB_LIBDMS_H
26#define _OTADM_LIB_LIBDMS_H 1
27
28///////////////
29// //
30// Headers //
31// //
32///////////////
33
34#ifdef HAVE_CONFIG_H
35#include <config.h>
36#endif
37
38#include <dms.h>
39
40
41///////////////////
42// //
43// Definitions //
44// //
45///////////////////
46
47#ifndef DMS_LIBS_DYNAMIC
48#define DMS_LIBS_DYNAMIC 1
49#endif
50
51#ifndef PACKAGE_TARNAME
52#define PACKAGE_TARNAME "dmstools"
53#endif
54
55#ifndef SYSCONFDIR
56#define SYSCONFDIR "/usr/local/etc"
57#endif
58
59#ifndef LIBEXECDIR
60#define LIBEXECDIR "/usr/local/libexec"
61#endif
62
63#ifndef MODULEDIR
64#define MODULEDIR "/usr/local/libexec/otadm"
65#endif
66
67
68///////////////////
69// //
70// i18l Support //
71// //
72///////////////////
73
74#ifdef HAVE_GETTEXT
75# include <gettext.h>
76# include <libintl.h>
77# define _(String) gettext (String)
78# define gettext_noop(String) String
79# define N_(String) gettext_noop (String)
80#else
81# define _(String) (String)
82# define N_(String) String
83# define textdomain(Domain)
84# define bindtextdomain(Package, Directory)
85#endif
86
87#endif /* end of header file */
diff --git a/lib/libdms.sym b/lib/libdms.sym
new file mode 100644
index 0000000..5334bd1
--- /dev/null
+++ b/lib/libdms.sym
@@ -0,0 +1,42 @@
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# lib/libdms.sym - list of symbols to export in libdms.la
23#
24# Build:
25# CFLAGS="-g -O2 -W -Wall -Werror -I../include"
26# LDFLAGS="-g -O2 -export-symbols libdms.sym -rpath /usr/local/lib"
27# export CFLAGS LDFLAGS
28#
29# libtool --mode=compile gcc ${CFLAGS} -c libdms_version.c
30# libtool --mode=link gcc ${LDFLAGS} -o libdms.la libdms_version.lo
31#
32# Install:
33# libtool --mode=install install -c libotadm.la /usr/local/lib/libacs-utils.la
34#
35# Uninstall:
36# libtool --mode=uninstall rm -f /usr/local/lib/libdms.la
37#
38# Clean:
39# libtool --mode=clean rm -f libdms.la libdms_version.lo
40#
41dms_version
42# end of symbol export file
diff --git a/lib/libdms_version.c b/lib/libdms_version.c
new file mode 100644
index 0000000..1ce7745
--- /dev/null
+++ b/lib/libdms_version.c
@@ -0,0 +1,49 @@
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_version.c functions for querying information about the library
24 */
25#define _DMS_LIB_LIBDMS_VERSION_C 1
26#include "libdms_version.h"
27
28///////////////
29// //
30// Headers //
31// //
32///////////////
33
34#include "libdms.h"
35
36
37/////////////////
38// //
39// Functions //
40// //
41/////////////////
42
43/// returns version info string for library
44const char * dms_version(void)
45{
46 return("libdms.la (" PACKAGE_NAME ") " PACKAGE_VERSION);
47}
48
49/* end of source code */
diff --git a/lib/libdms_version.h b/lib/libdms_version.h
new file mode 100644
index 0000000..a9cd8a2
--- /dev/null
+++ b/lib/libdms_version.h
@@ -0,0 +1,28 @@
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_version.h functions for querying information about the library
24 */
25#ifndef _DMS_LIB_LIBDMS_VERSION_H
26#define _DMS_LIB_LIBDMS_VERSION_H 1
27
28#endif /* end of source code */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2d0cfa4..a970934 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,9 +1,11 @@
1# List of source files which contain translatable strings. 1# List of source files which contain translatable strings.
2lib/libdms_version.c
2src/bindump.c 3src/bindump.c
3src/bitcopy.c 4src/bitcopy.c
4src/bitops.c 5src/bitops.c
5src/codetagger.c 6src/codetagger.c
6src/common.h 7src/common.h
8src/dmsversion.c
7src/numconvert.c 9src/numconvert.c
8src/posixregex.c 10src/posixregex.c
9src/typedef-info.c 11src/typedef-info.c
diff --git a/src/dmsversion.c b/src/dmsversion.c
new file mode 100644
index 0000000..d95eaab
--- /dev/null
+++ b/src/dmsversion.c
@@ -0,0 +1,130 @@
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 src/dmsversion.c displays library version
24 */
25/*
26 * Simple Build:
27 * gcc -W -Wall -O2 -c dmsversion.c
28 * gcc -W -Wall -O2 -o dmsversion dmsversion.o
29 *
30 * GNU Libtool Build:
31 * libtool --mode=compile gcc -W -Wall -g -O2 -c dmsversion.c
32 * libtool --mode=link gcc -W -Wall -g -O2 -o dmsversion dmsversion.lo
33 *
34 * GNU Libtool Install:
35 * libtool --mode=install install -c dmsversion /usr/local/bin/dmsversion
36 *
37 * GNU Libtool Clean:
38 * libtool --mode=clean rm -f dmsversion.lo dmsversion
39 */
40#define _DMS_SRC_DMSVERSION_C 1
41
42///////////////
43// //
44// Headers //
45// //
46///////////////
47
48#ifdef HAVE_CONFIG_H
49#include <config.h>
50#endif
51
52#include <stdio.h>
53#include <dms.h>
54
55
56///////////////////
57// //
58// i18l Support //
59// //
60///////////////////
61
62#ifdef HAVE_GETTEXT
63# include <gettext.h>
64# include <libintl.h>
65# define _(String) gettext (String)
66# define gettext_noop(String) String
67# define N_(String) gettext_noop (String)
68#else
69# define _(String) (String)
70# define N_(String) String
71# define textdomain(Domain)
72# define bindtextdomain(Package, Directory)
73#endif
74
75
76///////////////////
77// //
78// Definitions //
79// //
80///////////////////
81
82#ifndef PROGRAM_NAME
83#define PROGRAM_NAME "dmsversion"
84#endif
85#ifndef PACKAGE_BUGREPORT
86#define PACKAGE_BUGREPORT "david@syzdek.net"
87#endif
88#ifndef PACKAGE_COPYRIGHT
89#define PACKAGE_COPYRIGHT ""
90#endif
91#ifndef PACKAGE_NAME
92#define PACKAGE_NAME ""
93#endif
94#ifndef PACKAGE_VERSION
95#define PACKAGE_VERSION ""
96#endif
97
98#ifndef PARAMS
99#define PARAMS(protos) protos
100#endif
101
102
103//////////////////
104// //
105// Prototypes //
106// //
107//////////////////
108
109// main statement
110int main(int argc, char * argv[]);
111
112
113//////////////////
114// //
115// Prototypes //
116// //
117//////////////////
118
119/// main statement
120/// @param[in] argc number of arguments
121/// @param[in] argv array of arguments
122int main(int argc, char * argv[])
123{
124 if (argc == -1)
125 printf("%s\n", argv[0]);
126 printf("%s\n", dms_version());
127 return(0);
128}
129
130// end of source file