/ltmain.sh
/depcomp
/missing
+/compile
/stamp-h1
/install-sh
/arg-nonnull.h
SUBDIRS = lib .
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
-I$(top_builddir)/lib -I$(top_srcdir)/lib \
+ -DBISON_LOCALEDIR=\"$(BISON_LOCALEDIR)\" \
-DLOCALEDIR=\"$(localedir)\"
MAINTAINERCLEANFILES = src/scan.c src/scan.h src/scan.stamp \
dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3
include_HEADERS = src/cdecl.h
-noinst_HEADERS = src/typemap.h src/output.h src/scan.h src/parse.h
+noinst_HEADERS = src/typemap.h src/output.h src/scan.h src/parse.h src/i18n.h
noinst_DATA = $(MOFILES)
lib_LTLIBRARIES = libcdecl.la
libcdecl_la_LDFLAGS = -export-symbols-regex '^cdecl_[[:lower:]]'
libcdecl_la_SOURCES = src/scan.c src/parse.c src/parse-decl.c src/typemap.c \
- src/output.c src/explain.c src/declare.c
-libcdecl_la_LIBADD = $(LTLIBINTL)
+ src/output.c src/explain.c src/declare.c src/i18n.c
+libcdecl_la_LIBADD = $(LTLIBINTL) $(LTLIBTHREAD)
bin_PROGRAMS = cdecl99
cdecl99_SOURCES = src/cdecl99.c
AC_ARG_VAR([BISON], [Command to invoke GNU Bison. Defaults to bison.])
AC_ARG_VAR([BISONFLAGS], [Additional options to pass to Bison.])
AC_CHECK_PROGS([BISON], [bison], [bison])
+BISON_I18N
AC_CONFIG_FILES([
lib/Makefile
.Pp
.Nm
is intended to be portable to any system with a working C implementation that
-at least makes an effort to support C99. The library maintains no global state
-and thus all functions should be safe for use in a multi-threaded environment.
+at least makes an effort to support C99. The library is thread-safe when
+appropriate facilities exist and are enabled at build time.
.Sh ABSTRACT SYNTAX TREE
The functions in
.Nm
stdint_h.m4
stdio_h.m4
stdlib_h.m4
+thread.m4
threadlib.m4
uintmax_t.m4
unistd_h.m4
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --conditional-dependencies --libtool --macro-prefix=gl --no-vc-files getopt-gnu gettext readline
+# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --conditional-dependencies --libtool --macro-prefix=gl --no-vc-files getopt-gnu gettext lock readline
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([])
gl_MODULES([
getopt-gnu
gettext
+ lock
readline
])
gl_AVOID([])
--- /dev/null
+#include <config.h>
+#include <stdio.h>
+#include <assert.h>
+#include <glthread/lock.h>
+#include <gettext.h>
+#include "i18n.h"
+
+static void initialize(void)
+{
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ bindtextdomain("bison-runtime", BISON_LOCALEDIR);
+}
+
+void cdecl__init_i18n(void)
+{
+ gl_once_define(static, initialized);
+
+ int err = glthread_once(&initialized, initialize);
+ assert(err == 0);
+}
--- /dev/null
+#ifndef CDECL_I18N_H_
+#define CDECL_I18N_H_
+
+#include <gettext.h>
+
+#define _(s) dgettext(PACKAGE, s)
+#define N_(s) s
+
+void cdecl__init_i18n(void);
+
+#endif
#include "typemap.h"
#include "parse.h"
#include "scan.h"
+#include "i18n.h"
/*
* Determine if a declarator declares an identifier (other than a function
struct cdecl *decl;
int rc;
+ cdecl__init_i18n();
+
rc = cdecl__yylex_init(&scanner);
if (rc != 0)
return NULL;
struct cdecl *decl;
int rc;
+ cdecl__init_i18n();
+
rc = cdecl__yylex_init_extra(true, &scanner);
if (rc != 0)
return NULL;
%locations
%{
+#include <config.h>
#include <assert.h>
#include <stdbool.h>