diff options
47 files changed, 871 insertions, 477 deletions
@@ -46,4 +46,7 @@ build-aux/missing build-aux/config.guess build-aux/depcomp build-aux/ltmain.sh -/nbproject/private/
\ No newline at end of file +/nbproject/private/ +lib/.libs/ +lib/dummy.lo +lib/libgnu.la diff --git a/Makefile.am b/Makefile.am index 6460d8fb..f093d39a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,7 @@ endif AM_CFLAGS = -Wall @MAIN_CFLAGS@ AM_CPPFLAGS = -DDATADIR=\""$(datadir)"\" -I$(top_builddir)/lib AM_CPPFLAGS += -I$(top_srcdir)/lib -LDADD = $(top_builddir)/lib/libgnu.a @IGNORE_UNUSED_LIBRARIES_CFLAGS@ +LDADD = $(top_builddir)/lib/libgnu.la @IGNORE_UNUSED_LIBRARIES_CFLAGS@ LDADD += $(top_builddir)/libcrystfel/libcrystfel.la @MAIN_LIBS@ src_partial_sim_SOURCES = src/partial_sim.c diff --git a/build-aux/arg-nonnull.h b/build-aux/snippet/arg-nonnull.h index 6c2f1e82..3a9dd266 100644 --- a/build-aux/arg-nonnull.h +++ b/build-aux/snippet/arg-nonnull.h @@ -1,5 +1,5 @@ /* A C macro for declaring that specific arguments must not be NULL. - Copyright (C) 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2009-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/build-aux/c++defs.h b/build-aux/snippet/c++defs.h index b6821a64..96da94b9 100644 --- a/build-aux/c++defs.h +++ b/build-aux/snippet/c++defs.h @@ -1,5 +1,5 @@ /* C++ compatible function declaration macros. - Copyright (C) 2010-2011 Free Software Foundation, Inc. + Copyright (C) 2010-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/build-aux/warn-on-use.h b/build-aux/snippet/warn-on-use.h index 2cdeec3e..d4cb94f3 100644 --- a/build-aux/warn-on-use.h +++ b/build-aux/snippet/warn-on-use.h @@ -1,5 +1,5 @@ /* A C macro for emitting warnings if a function is used. - Copyright (C) 2010-2011 Free Software Foundation, Inc. + Copyright (C) 2010-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published diff --git a/doc/twin-calculator.odt b/doc/twin-calculator.odt Binary files differindex 16e43495..108aac55 100644 --- a/doc/twin-calculator.odt +++ b/doc/twin-calculator.odt diff --git a/doc/twin-calculator.pdf b/doc/twin-calculator.pdf Binary files differindex 9f4735a7..1559fc96 100644 --- a/doc/twin-calculator.pdf +++ b/doc/twin-calculator.pdf diff --git a/lib/Makefile.am b/lib/Makefile.am index 835dc32b..238cd918 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,15 +1,27 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2011 Free Software Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see <http://www.gnu.org/licenses/>. +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-libtool --macro-prefix=gl lib-ignore strndup +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl lib-ignore strndup AUTOMAKE_OPTIONS = 1.5 gnits @@ -29,14 +41,16 @@ MAINTAINERCLEANFILES = AM_CPPFLAGS = AM_CFLAGS = -noinst_LIBRARIES += libgnu.a +noinst_LTLIBRARIES += libgnu.la -libgnu_a_SOURCES = -libgnu_a_LIBADD = $(gl_LIBOBJS) -libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) -EXTRA_libgnu_a_SOURCES = +libgnu_la_SOURCES = +libgnu_la_LIBADD = $(gl_LTLIBOBJS) +libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) +EXTRA_libgnu_la_SOURCES = +libgnu_la_LDFLAGS = $(AM_LDFLAGS) +libgnu_la_LDFLAGS += -no-undefined -## begin gnulib module arg-nonnull +## begin gnulib module snippet/arg-nonnull # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be @@ -45,22 +59,23 @@ EXTRA_libgnu_a_SOURCES = BUILT_SOURCES += arg-nonnull.h # The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/arg-nonnull.h, except that it has the copyright header cut off. -arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h +# build-aux/snippet/arg-nonnull.h, except that it has the copyright header cut +# off. +arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/arg-nonnull.h \ + < $(top_srcdir)/build-aux/snippet/arg-nonnull.h \ > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t ARG_NONNULL_H=arg-nonnull.h -EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/arg-nonnull.h -## end gnulib module arg-nonnull +## end gnulib module snippet/arg-nonnull -## begin gnulib module c++defs +## begin gnulib module snippet/c++defs # The BUILT_SOURCES created by this Makefile snippet are not used via #include # statements but through direct file reference. Therefore this snippet must be @@ -69,20 +84,40 @@ EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h BUILT_SOURCES += c++defs.h # The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/c++defs.h +# build-aux/snippet/c++defs.h, except that it has the copyright header cut off. +c++defs.h: $(top_srcdir)/build-aux/snippet/c++defs.h $(AM_V_GEN)rm -f $@-t $@ && \ sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/c++defs.h \ + < $(top_srcdir)/build-aux/snippet/c++defs.h \ > $@-t && \ mv $@-t $@ MOSTLYCLEANFILES += c++defs.h c++defs.h-t CXXDEFS_H=c++defs.h -EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/c++defs.h + +## end gnulib module snippet/c++defs + +## begin gnulib module snippet/warn-on-use + +BUILT_SOURCES += warn-on-use.h +# The warn-on-use.h that gets inserted into generated .h files is the same as +# build-aux/snippet/warn-on-use.h, except that it has the copyright header cut +# off. +warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h + $(AM_V_GEN)rm -f $@-t $@ && \ + sed -n -e '/^.ifndef/,$$p' \ + < $(top_srcdir)/build-aux/snippet/warn-on-use.h \ + > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t + +WARN_ON_USE_H=warn-on-use.h -## end gnulib module c++defs +EXTRA_DIST += $(top_srcdir)/build-aux/snippet/warn-on-use.h + +## end gnulib module snippet/warn-on-use ## begin gnulib module stddef @@ -94,7 +129,8 @@ if GL_GENERATE_STDDEF_H stddef.h: stddef.in.h $(top_builddir)/config.status $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ @@ -122,47 +158,52 @@ BUILT_SOURCES += string.h string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ - sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ - -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \ - -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \ - -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \ - -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \ - -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \ - -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \ - -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \ - -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \ - -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \ - -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \ - -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \ - -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \ - -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \ - -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \ - -e 's|@''GNULIB_MEMCHR''@|$(GNULIB_MEMCHR)|g' \ - -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \ - -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \ - -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \ - -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \ - -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \ - -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \ - -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \ - -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \ - -e 's|@''GNULIB_STRNCAT''@|$(GNULIB_STRNCAT)|g' \ - -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \ - -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \ - -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \ - -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \ - -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \ - -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \ - -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \ - -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \ - -e 's|@''GNULIB_STRERROR_R''@|$(GNULIB_STRERROR_R)|g' \ - -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \ - -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \ + -e 's/@''GNULIB_FFSL''@/$(GNULIB_FFSL)/g' \ + -e 's/@''GNULIB_FFSLL''@/$(GNULIB_FFSLL)/g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GNULIB_STRCASESTR)/g' \ + -e 's/@''GNULIB_STRTOK_R''@/$(GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STRERROR''@/$(GNULIB_STRERROR)/g' \ + -e 's/@''GNULIB_STRERROR_R''@/$(GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRSIGNAL''@/$(GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GNULIB_STRVERSCMP)/g' \ < $(srcdir)/string.in.h | \ - sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + sed -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ + -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ -e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ @@ -213,7 +254,7 @@ EXTRA_DIST += string.in.h EXTRA_DIST += strndup.c -EXTRA_libgnu_a_SOURCES += strndup.c +EXTRA_libgnu_la_SOURCES += strndup.c ## end gnulib module strndup @@ -222,32 +263,13 @@ EXTRA_libgnu_a_SOURCES += strndup.c EXTRA_DIST += strnlen.c -EXTRA_libgnu_a_SOURCES += strnlen.c +EXTRA_libgnu_la_SOURCES += strnlen.c ## end gnulib module strnlen -## begin gnulib module warn-on-use - -BUILT_SOURCES += warn-on-use.h -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/warn-on-use.h, except that it has the copyright header cut off. -warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t - -WARN_ON_USE_H=warn-on-use.h - -EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h - -## end gnulib module warn-on-use - ## begin gnulib module dummy -libgnu_a_SOURCES += dummy.c +libgnu_la_SOURCES += dummy.c ## end gnulib module dummy diff --git a/lib/dummy.c b/lib/dummy.c index c958ea05..6e4b76e0 100644 --- a/lib/dummy.c +++ b/lib/dummy.c @@ -1,5 +1,5 @@ /* A dummy file, to prevent empty libraries from breaking builds. - Copyright (C) 2004, 2007, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/stddef.in.h b/lib/stddef.in.h index 62a91a7a..17fcaea2 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -1,6 +1,6 @@ /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues. - Copyright (C) 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2009-2012 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ /* Written by Eric Blake. */ @@ -38,9 +37,9 @@ remember if special invocation has ever been used to obtain wint_t, in which case we need to clean up NULL yet again. */ -# if !(defined _GL_STDDEF_H && defined _GL_STDDEF_WINT_T) +# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) # ifdef __need_wint_t -# undef _GL_STDDEF_H +# undef _@GUARD_PREFIX@_STDDEF_H # define _GL_STDDEF_WINT_T # endif # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ @@ -49,14 +48,14 @@ #else /* Normal invocation convention. */ -# ifndef _GL_STDDEF_H +# ifndef _@GUARD_PREFIX@_STDDEF_H /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_STDDEF_H@ -# ifndef _GL_STDDEF_H -# define _GL_STDDEF_H +# ifndef _@GUARD_PREFIX@_STDDEF_H +# define _@GUARD_PREFIX@_STDDEF_H /* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ #if @REPLACE_NULL@ @@ -82,6 +81,6 @@ # define wchar_t int #endif -# endif /* _GL_STDDEF_H */ -# endif /* _GL_STDDEF_H */ +# endif /* _@GUARD_PREFIX@_STDDEF_H */ +# endif /* _@GUARD_PREFIX@_STDDEF_H */ #endif /* __need_XXX */ diff --git a/lib/string.in.h b/lib/string.in.h index 76d26ed3..f8d7520e 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like <string.h>. - Copyright (C) 1995-1996, 2001-2011 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2012 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -13,10 +13,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef _GL_STRING_H +#ifndef _@GUARD_PREFIX@_STRING_H #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ @@ -26,8 +25,8 @@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ -#ifndef _GL_STRING_H -#define _GL_STRING_H +#ifndef _@GUARD_PREFIX@_STRING_H +#define _@GUARD_PREFIX@_STRING_H /* NetBSD 5.0 mis-defines NULL. */ #include <stddef.h> @@ -59,6 +58,36 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSL@ +# if !@HAVE_FFSL@ +_GL_FUNCDECL_SYS (ffsl, int, (long int i)); +# endif +_GL_CXXALIAS_SYS (ffsl, int, (long int i)); +_GL_CXXALIASWARN (ffsl); +#elif defined GNULIB_POSIXCHECK +# undef ffsl +# if HAVE_RAW_DECL_FFSL +_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); +# endif +#endif + + +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSLL@ +# if !@HAVE_FFSLL@ +_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); +# endif +_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); +_GL_CXXALIASWARN (ffsll); +#elif defined GNULIB_POSIXCHECK +# undef ffsll +# if HAVE_RAW_DECL_FFSLL +_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); +# endif +#endif + + /* Return the first instance of C within N bytes of S, or NULL. */ #if @GNULIB_MEMCHR@ # if @REPLACE_MEMCHR@ @@ -695,10 +724,14 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbslen rpl_mbslen # endif -_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); # else -_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); # endif _GL_CXXALIASWARN (mbslen); @@ -708,6 +741,7 @@ _GL_CXXALIASWARN (mbslen); /* Return the number of multibyte characters in the character string starting at STRING and ending at STRING + LEN. */ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1)); #endif @@ -721,10 +755,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) # define mbschr rpl_mbschr /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); # endif @@ -736,15 +772,17 @@ _GL_CXXALIASWARN (mbschr); and return a pointer to it. Return NULL if C is not found in STRING. Unlike strrchr(), this function works correctly in multibyte locales with encodings such as GB18030. */ -# if defined __hpux +# if defined __hpux || defined __INTERIX # if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */ +# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ # endif _GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); # else _GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); # endif @@ -757,6 +795,7 @@ _GL_CXXALIASWARN (mbsrchr); Unlike strstr(), this function works correctly in multibyte locales with encodings different from UTF-8. */ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -768,6 +807,7 @@ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) different lengths! Unlike strcasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -782,6 +822,7 @@ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) Unlike strncasecmp(), this function works correctly in multibyte locales. But beware that N is not a byte count but a character count! */ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -795,6 +836,7 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) Unlike strncasecmp(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -805,6 +847,7 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) strlen (haystack) < strlen (needle) ! Unlike strcasestr(), this function works correctly in multibyte locales. */ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -815,6 +858,7 @@ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) if none exists. Unlike strcspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -828,10 +872,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) # define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ # endif _GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); # else _GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); _GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); # endif @@ -845,6 +891,7 @@ _GL_CXXALIASWARN (mbspbrk); if none exists. Unlike strspn(), this function works correctly in multibyte locales. */ _GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2)); #endif @@ -964,6 +1011,7 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - " #if @GNULIB_STRVERSCMP@ # if !@HAVE_STRVERSCMP@ _GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) + _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1, 2))); # endif _GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); @@ -977,5 +1025,5 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " #endif -#endif /* _GL_STRING_H */ -#endif /* _GL_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ diff --git a/lib/strndup.c b/lib/strndup.c index 4a3bece4..40538711 100644 --- a/lib/strndup.c +++ b/lib/strndup.c @@ -1,6 +1,6 @@ /* A replacement function, for systems that lack strndup. - Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2011 Free Software + Copyright (C) 1996-1998, 2001-2003, 2005-2007, 2009-2012 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it @@ -14,8 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/lib/strnlen.c b/lib/strnlen.c index 3cefa978..d36180dc 100644 --- a/lib/strnlen.c +++ b/lib/strnlen.c @@ -1,5 +1,5 @@ /* Find the length of STRING, but scan at most MAXLEN characters. - Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc. + Copyright (C) 2005-2007, 2009-2012 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include <config.h> diff --git a/libcrystfel/Makefile.am b/libcrystfel/Makefile.am index d13bbc93..bd84ceff 100644 --- a/libcrystfel/Makefile.am +++ b/libcrystfel/Makefile.am @@ -1,5 +1,5 @@ lib_LTLIBRARIES = libcrystfel.la -libcrystfel_la_LIBADD = @LIBCRYSTFEL_LIBS@ +libcrystfel_la_LIBADD = ../lib/libgnu.la @LIBCRYSTFEL_LIBS@ libcrystfel_la_LDFLAGS = -version-info=0:0:0 libcrystfel_la_SOURCES = src/reflist.c src/utils.c src/cell.c src/detector.c \ diff --git a/libcrystfel/src/cell.c b/libcrystfel/src/cell.c index 2e87b770..b6ea010b 100644 --- a/libcrystfel/src/cell.c +++ b/libcrystfel/src/cell.c @@ -424,7 +424,7 @@ int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c, switch ( cell->rep ) { - case CELL_REP_CRYST: + case CELL_REP_CRYST: /* Direct response */ *a = cell->a; *b = cell->b; @@ -434,7 +434,7 @@ int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c, *gamma = cell->gamma; return 0; - case CELL_REP_CART: + case CELL_REP_CART: /* Convert cartesian -> crystallographic */ *a = modulus(cell->ax, cell->ay, cell->az); *b = modulus(cell->bx, cell->by, cell->bz); @@ -448,7 +448,7 @@ int cell_get_parameters(UnitCell *cell, double *a, double *b, double *c, cell->bx, cell->by, cell->bz); return 0; - case CELL_REP_RECIP: + case CELL_REP_RECIP: /* Convert reciprocal -> crystallographic. * Start by converting reciprocal -> cartesian */ cell_invert(cell->axs, cell->ays, cell->azs, @@ -480,21 +480,21 @@ int cell_get_cartesian(UnitCell *cell, switch ( cell->rep ) { - case CELL_REP_CRYST: + case CELL_REP_CRYST: /* Convert crystallographic -> cartesian. */ return cell_crystallographic_to_cartesian(cell, ax, ay, az, bx, by, bz, cx, cy, cz); - case CELL_REP_CART: + case CELL_REP_CART: /* Direct response */ *ax = cell->ax; *ay = cell->ay; *az = cell->az; *bx = cell->bx; *by = cell->by; *bz = cell->bz; *cx = cell->cx; *cy = cell->cy; *cz = cell->cz; return 0; - case CELL_REP_RECIP: + case CELL_REP_RECIP: /* Convert reciprocal -> cartesian */ return cell_invert(cell->axs, cell->ays, cell->azs, cell->bxs, cell->bys, cell->bzs, @@ -518,7 +518,7 @@ int cell_get_reciprocal(UnitCell *cell, switch ( cell->rep ) { - case CELL_REP_CRYST: + case CELL_REP_CRYST: /* Convert crystallographic -> reciprocal */ r = cell_crystallographic_to_cartesian(cell, &ax, &ay, &az, @@ -528,7 +528,7 @@ int cell_get_reciprocal(UnitCell *cell, return cell_invert(ax, ay, az,bx, by, bz, cx, cy, cz, asx, asy, asz, bsx, bsy, bsz, csx, csy, csz); - case CELL_REP_CART: + case CELL_REP_CART: /* Convert cartesian -> reciprocal */ cell_invert(cell->ax, cell->ay, cell->az, cell->bx, cell->by, cell->bz, @@ -536,7 +536,7 @@ int cell_get_reciprocal(UnitCell *cell, asx, asy, asz, bsx, bsy, bsz, csx, csy, csz); return 0; - case CELL_REP_RECIP: + case CELL_REP_RECIP: /* Direct response */ *asx = cell->axs; *asy = cell->ays; *asz = cell->azs; *bsx = cell->bxs; *bsy = cell->bys; *bsz = cell->bzs; @@ -569,12 +569,16 @@ const char *cell_get_spacegroup(UnitCell *cell) static const char *cell_rep(UnitCell *cell) { switch ( cell->rep ) { - case CELL_REP_CRYST: + + case CELL_REP_CRYST: return "crystallographic, direct space"; - case CELL_REP_CART: + + case CELL_REP_CART: return "cartesian, direct space"; - case CELL_REP_RECIP: + + case CELL_REP_RECIP: return "cartesian, reciprocal space"; + } return "unknown"; diff --git a/libcrystfel/src/dirax.c b/libcrystfel/src/dirax.c index 20f48bd3..43de6c6e 100644 --- a/libcrystfel/src/dirax.c +++ b/libcrystfel/src/dirax.c @@ -226,37 +226,37 @@ static void dirax_send_next(struct image *image, struct dirax_data *dirax) switch ( dirax->step ) { - case 1 : + case 1 : dirax_sendline("\\echo off\n", dirax); break; - case 2 : + case 2 : snprintf(tmp, 31, "read xfel-%i.drx\n", image->id); dirax_sendline(tmp, dirax); break; - case 3 : + case 3 : dirax_sendline("dmax 1000\n", dirax); break; - case 4 : + case 4 : dirax_sendline("indexfit 2\n", dirax); break; - case 5 : + case 5 : dirax_sendline("levelfit 1000\n", dirax); break; - case 6 : + case 6 : dirax_sendline("go\n", dirax); dirax->finished_ok = 1; break; - case 7 : + case 7 : dirax_sendline("acl\n", dirax); break; - case 8 : + case 8 : if ( dirax->best_acl_nh == 0 ) { /* At this point, DirAx is presenting its ACL prompt * and waiting for a single number. Use an extra @@ -270,11 +270,11 @@ static void dirax_send_next(struct image *image, struct dirax_data *dirax) dirax_sendline(tmp, dirax); break; - case 9 : + case 9 : dirax_sendline("cell\n", dirax); break; - case 10 : + case 10 : if ( dirax->n_acls_tried == MAX_DIRAX_CELL_CANDIDATES ) { dirax_sendline("exit\n", dirax); } else { @@ -285,7 +285,7 @@ static void dirax_send_next(struct image *image, struct dirax_data *dirax) } break; - default: + default: dirax_sendline("exit\n", dirax); return; diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c index 88d11bff..af06c1b4 100644 --- a/libcrystfel/src/hdf5-file.c +++ b/libcrystfel/src/hdf5-file.c @@ -719,6 +719,10 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name) hsize_t max_size; hid_t type; hid_t class; + herr_t r; + int buf_i; + double buf_f; + char *tmp; dh = H5Dopen2(f->fh, name, H5P_DEFAULT); if ( dh < 0 ) return NULL; @@ -761,40 +765,33 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name) } switch ( class ) { - case H5T_FLOAT : { - herr_t r; - double buf; - char *tmp; + case H5T_FLOAT : r = H5Dread(dh, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, - H5P_DEFAULT, &buf); + H5P_DEFAULT, &buf_f); if ( r < 0 ) goto fail; tmp = malloc(256); - snprintf(tmp, 255, "%f", buf); + snprintf(tmp, 255, "%f", buf_f); return tmp; - } - case H5T_INTEGER : { + case H5T_INTEGER : - herr_t r; - int buf; - char *tmp; r = H5Dread(dh, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - H5P_DEFAULT, &buf); + H5P_DEFAULT, &buf_i); if ( r < 0 ) goto fail; tmp = malloc(256); - snprintf(tmp, 255, "%d", buf); + snprintf(tmp, 255, "%d", buf_i); return tmp; - } - default : { + + default : goto fail; - } + } fail: diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 2baa2644..102a5312 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -83,18 +83,23 @@ IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell, for ( n=0; n<nm; n++ ) { switch ( indm[n] ) { - case INDEXING_NONE : + + case INDEXING_NONE : ERROR("Tried to prepare INDEXING_NONE!\n"); break; - case INDEXING_DIRAX : + + case INDEXING_DIRAX : iprivs[n] = indexing_private(indm[n]); break; - case INDEXING_MOSFLM : + + case INDEXING_MOSFLM : iprivs[n] = indexing_private(indm[n]); break; - case INDEXING_REAX : + + case INDEXING_REAX : iprivs[n] = reax_prepare(); break; + } } @@ -113,18 +118,23 @@ void cleanup_indexing(IndexingPrivate **priv) while ( priv[n] != NULL ) { switch ( priv[n]->indm ) { - case INDEXING_NONE : + + case INDEXING_NONE : free(priv[n]); break; - case INDEXING_DIRAX : + + case INDEXING_DIRAX : free(priv[n]); break; - case INDEXING_MOSFLM : + + case INDEXING_MOSFLM : free(priv[n]); break; - case INDEXING_REAX : + + case INDEXING_REAX : reax_cleanup(priv[n]); break; + } n++; @@ -173,17 +183,22 @@ void index_pattern(struct image *image, UnitCell *cell, IndexingMethod *indm, /* Index as appropriate */ switch ( indm[n] ) { - case INDEXING_NONE : + + case INDEXING_NONE : return; - case INDEXING_DIRAX : + + case INDEXING_DIRAX : run_dirax(image); break; - case INDEXING_MOSFLM : + + case INDEXING_MOSFLM : run_mosflm(image, cell); break; - case INDEXING_REAX : + + case INDEXING_REAX : reax_index(ipriv[n], image, cell); break; + } if ( image->ncells == 0 ) { n++; @@ -205,20 +220,25 @@ void index_pattern(struct image *image, UnitCell *cell, IndexingMethod *indm, /* Match or reduce the cell as appropriate */ switch ( cellr ) { - case CELLR_NONE : + + case CELLR_NONE : new_cell = cell_new_from_cell(cand); break; - case CELLR_REDUCE : + + case CELLR_REDUCE : new_cell = match_cell(cand, cell, verbose, ltl, 1); break; - case CELLR_COMPARE : + + case CELLR_COMPARE : new_cell = match_cell(cand, cell, verbose, ltl, 0); break; - case CELLR_COMPARE_AB : + + case CELLR_COMPARE_AB : new_cell = match_cell_ab(cand, cell); break; + } /* No cell? Move on to the next candidate */ diff --git a/libcrystfel/src/mosflm.c b/libcrystfel/src/mosflm.c index 0032a095..ed118aa4 100644 --- a/libcrystfel/src/mosflm.c +++ b/libcrystfel/src/mosflm.c @@ -283,13 +283,13 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm) switch ( mosflm->step ) { - case 1 : + case 1 : mosflm_sendline("DETECTOR ROTATION HORIZONTAL" " ANTICLOCKWISE ORIGIN LL FAST HORIZONTAL" " RECTANGULAR\n", mosflm); break; - case 2 : + case 2 : if ( mosflm->target_cell != NULL ) { cell_get_parameters(mosflm->target_cell, &a, &b, &c, &alpha, &beta, &gamma); @@ -303,7 +303,7 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm) } break; - case 3 : + case 3 : if ( mosflm->target_cell != NULL ) { sg = cell_get_spacegroup(mosflm->target_cell); /* Remove white space from space group */ @@ -321,31 +321,31 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm) } break; - case 4 : + case 4 : mosflm_sendline("DISTANCE 67.8\n", mosflm); break; - case 5 : + case 5 : mosflm_sendline("BEAM 0.0 0.0\n", mosflm); break; - case 6 : + case 6 : wavelength = image->lambda*1e10; snprintf(tmp, 255, "WAVELENGTH %10.5f\n", wavelength); mosflm_sendline(tmp, mosflm); break; - case 7 : + case 7 : snprintf(tmp, 255, "NEWMAT %s\n", mosflm->newmatfile); mosflm_sendline(tmp, mosflm); break; - case 8 : + case 8 : snprintf(tmp, 255, "IMAGE %s phi 0 0\n", mosflm->imagefile); mosflm_sendline(tmp, mosflm); break; - case 9 : + case 9 : snprintf(tmp, 255, "AUTOINDEX DPS FILE %s" " IMAGE 1 MAXCELL 1000 REFINE\n", mosflm->sptfile); @@ -357,7 +357,7 @@ static void mosflm_send_next(struct image *image, struct mosflm_data *mosflm) mosflm_sendline(tmp, mosflm); break; - case 10 : + case 10 : mosflm_sendline("GO\n", mosflm); mosflm->finished_ok = 1; break; diff --git a/libcrystfel/src/render.c b/libcrystfel/src/render.c index c9e1f01e..5d0cf9e8 100644 --- a/libcrystfel/src/render.c +++ b/libcrystfel/src/render.c @@ -64,34 +64,35 @@ static void render_rgb(double val, double max, s = 6; } switch ( s ) { - case 0 : { /* Black to blue */ - r = 0; g = 0; b = p; - break; - } - case 1 : { /* Blue to pink */ - r = p; g = 0; b = 1.0; - break; - } - case 2 : { /* Pink to red */ - r = 1.0; g = 0; b = (1.0-p)*1.0; - break; - } - case 3 : { /* Red to Orange */ - r = 1.0; g = 0.5*p; b = 0; - break; - } - case 4 : { /* Orange to Yellow */ - r = 1.0; g = 0.5 + 0.5*p; b = 0; - break; - } - case 5 : { /* Yellow to White */ - r = 1.0; g = 1.0; b = 1.0*p; - break; - } - case 6 : { /* Pixel has hit the maximum value */ - r = 1.0; g = 1.0; b = 1.0; - break; - } + + case 0 : /* Black to blue */ + r = 0; g = 0; b = p; + break; + + case 1 : /* Blue to pink */ + r = p; g = 0; b = 1.0; + break; + + case 2 : /* Pink to red */ + r = 1.0; g = 0; b = (1.0-p)*1.0; + break; + + case 3 : /* Red to Orange */ + r = 1.0; g = 0.5*p; b = 0; + break; + + case 4 : /* Orange to Yellow */ + r = 1.0; g = 0.5 + 0.5*p; b = 0; + break; + + case 5 : /* Yellow to White */ + r = 1.0; g = 1.0; b = 1.0*p; + break; + + case 6 : /* Pixel has hit the maximum value */ + r = 1.0; g = 1.0; b = 1.0; + break; + } *rp = r; @@ -144,16 +145,20 @@ void render_scale(double val, double max, int scale, double *rp, double *gp, double *bp) { switch ( scale ) { - case SCALE_COLOUR : + + case SCALE_COLOUR : render_rgb(val, max, rp, gp, bp); break; - case SCALE_MONO : + + case SCALE_MONO : render_mono(val, max, rp, gp, bp); break; - case SCALE_INVMONO : + + case SCALE_INVMONO : render_invmono(val, max, rp, gp, bp); break; - case SCALE_RATIO : + + case SCALE_RATIO : render_ratio(val, max, rp, gp, bp); break; } diff --git a/libcrystfel/src/statistics.c b/libcrystfel/src/statistics.c index 6ddf2850..56273fdb 100644 --- a/libcrystfel/src/statistics.c +++ b/libcrystfel/src/statistics.c @@ -407,22 +407,28 @@ static double calc_r(double scale, void *params) struct r_params *rp = params; switch ( rp->fom ) { - case R_1_ZERO : + + case R_1_ZERO : return internal_r1_negstozero(rp->list1, rp->list2, scale); - case R_1_IGNORE : + + case R_1_IGNORE : return internal_r1_ignorenegs(rp->list1, rp->list2, scale); - case R_2 : + + case R_2 : return internal_r2(rp->list1, rp->list2, scale); - case R_1_I : + case R_1_I : return internal_r_i(rp->list1, rp->list2, scale); - case R_DIFF_ZERO : + case R_DIFF_ZERO : return internal_rdiff_negstozero(rp->list1, rp->list2,scale); - case R_DIFF_IGNORE : + + case R_DIFF_IGNORE : return internal_rdiff_ignorenegs(rp->list1, rp->list2, scale); - case R_DIFF_INTENSITY : + + case R_DIFF_INTENSITY : return internal_rdiff_intensity(rp->list1, rp->list2, scale); + } ERROR("No such FoM!\n"); @@ -457,17 +463,20 @@ static double r_minimised(RefList *list1, RefList *list2, double *scalep, int fo /* Initial guess */ switch ( fom ) { - case R_1_ZERO : - case R_1_IGNORE : - case R_DIFF_ZERO : - case R_DIFF_IGNORE : + + case R_1_ZERO : + case R_1_IGNORE : + case R_DIFF_ZERO : + case R_DIFF_IGNORE : scale = stat_scale_sqrti(list1, list2); break; - case R_2 : - case R_1_I : - case R_DIFF_INTENSITY : + + case R_2 : + case R_1_I : + case R_DIFF_INTENSITY : scale = stat_scale_intensity(list1, list2); break; + } //STATUS("Initial scale factor estimate: %5.2e\n", scale); diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4 index 7feed466..d978cb89 100644 --- a/m4/00gnulib.m4 +++ b/m4/00gnulib.m4 @@ -1,5 +1,5 @@ # 00gnulib.m4 serial 2 -dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/extensions.m4 b/m4/extensions.m4 index 1330503f..0bfaef6f 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 @@ -1,7 +1,7 @@ -# serial 9 -*- Autoconf -*- +# serial 11 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -43,7 +43,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], - [Define to 1 if you need to in order for `stat' and other + [Define to 1 if you need to in order for 'stat' and other things to work.]) AC_DEFINE([_POSIX_1_SOURCE], [2], [Define to 2 if the system does not provide POSIX.1 features @@ -67,6 +67,10 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif +/* Enable general extensions on MacOS X. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE @@ -95,6 +99,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl test $ac_cv_safe_to_define___extensions__ = yes && AC_DEFINE([__EXTENSIONS__]) AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_TANDEM_SOURCE]) diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index c93243e0..acc9a4c9 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -1,9 +1,21 @@ -# Copyright (C) 2002-2011 Free Software Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see <http://www.gnu.org/licenses/>. +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. @@ -15,7 +27,7 @@ # 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=build-aux --no-libtool --macro-prefix=gl lib-ignore strndup +# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --libtool --macro-prefix=gl lib-ignore strndup # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) @@ -31,5 +43,7 @@ gl_DOC_BASE([doc]) gl_TESTS_BASE([tests]) gl_LIB([libgnu]) gl_MAKEFILE_NAME([]) +gl_LIBTOOL gl_MACRO_PREFIX([gl]) gl_PO_DOMAIN([]) +gl_WITNESS_C_DOMAIN([]) diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index c4d7a20e..d62b7677 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ -# gnulib-common.m4 serial 24 -dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. +# gnulib-common.m4 serial 32 +dnl Copyright (C) 2007-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,6 +12,20 @@ AC_DEFUN([gl_COMMON], [ AC_REQUIRE([gl_COMMON_BODY]) ]) AC_DEFUN([gl_COMMON_BODY], [ + AH_VERBATIM([_Noreturn], +[/* The _Noreturn keyword of C11. */ +#if ! (defined _Noreturn \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif +]) AH_VERBATIM([isoc99_inline], [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of @@ -34,6 +48,20 @@ AC_DEFUN([gl_COMMON_BODY], [ /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name is a misnomer outside of parameter lists. */ #define _UNUSED_PARAMETER_ _GL_UNUSED + +/* The __pure__ attribute was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* The __const__ attribute was added in gcc 2.95. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif ]) dnl Preparation for running test programs: dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not @@ -47,16 +75,49 @@ AC_DEFUN([gl_COMMON_BODY], [ # expands to a C preprocessor expression that evaluates to 1 or 0, depending # whether a gnulib module that has been requested shall be considered present # or not. -AC_DEFUN([gl_MODULE_INDICATOR_CONDITION], [1]) +m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) # gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) # sets the shell variable that indicates the presence of the given module to # a C preprocessor expression that will evaluate to 1. AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], [ - GNULIB_[]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=gl_MODULE_INDICATOR_CONDITION + gl_MODULE_INDICATOR_SET_VARIABLE_AUX( + [GNULIB_[]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], + [gl_MODULE_INDICATOR_CONDITION]) +]) + +# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable]) +# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION. +# The shell variable's value is a C preprocessor expression that evaluates +# to 0 or 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX], +[ + m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1], + [ + dnl Simplify the expression VALUE || 1 to 1. + $1=1 + ], + [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1], + [gl_MODULE_INDICATOR_CONDITION])]) +]) + +# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition]) +# modifies the shell variable to include the given condition. The shell +# variable's value is a C preprocessor expression that evaluates to 0 or 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR], +[ + dnl Simplify the expression 1 || CONDITION to 1. + if test "$[]$1" != 1; then + dnl Simplify the expression 0 || CONDITION to CONDITION. + if test "$[]$1" = 0; then + $1=$2 + else + $1="($[]$1 || $2)" + fi + fi ]) # gl_MODULE_INDICATOR([modulename]) @@ -151,6 +212,83 @@ m4_ifndef([AS_VAR_IF], [m4_define([AS_VAR_IF], [AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) +# gl_PROG_CC_C99 +# Modifies the value of the shell variable CC in an attempt to make $CC +# understand ISO C99 source code. +# This is like AC_PROG_CC_C99, except that +# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60, +# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC +# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00367.html>, +# but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99 +# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00441.html>. +# Remaining problems: +# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options +# to CC twice +# <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>. +# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard. +AC_DEFUN([gl_PROG_CC_C99], +[ + dnl Change that version number to the minimum Autoconf version that supports + dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls. + m4_version_prereq([9.0], + [AC_REQUIRE([AC_PROG_CC_C99])], + [AC_REQUIRE([AC_PROG_CC_STDC])]) +]) + +# gl_PROG_AR_RANLIB +# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler. +# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override +# the values. +AC_DEFUN([gl_PROG_AR_RANLIB], +[ + dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler + dnl as "cc", and GCC as "gcc". They have different object file formats and + dnl library formats. In particular, the GNU binutils programs ar, ranlib + dnl produce libraries that work only with gcc, not with cc. + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], + [ + AC_EGREP_CPP([Amsterdam], + [ +#ifdef __ACK__ +Amsterdam +#endif + ], + [gl_cv_c_amsterdam_compiler=yes], + [gl_cv_c_amsterdam_compiler=no]) + ]) + if test -z "$AR"; then + if test $gl_cv_c_amsterdam_compiler = yes; then + AR='cc -c.a' + if test -z "$ARFLAGS"; then + ARFLAGS='-o' + fi + else + dnl Use the Automake-documented default values for AR and ARFLAGS, + dnl but prefer ${host}-ar over ar (useful for cross-compiling). + AC_CHECK_TOOL([AR], [ar], [ar]) + if test -z "$ARFLAGS"; then + ARFLAGS='cru' + fi + fi + else + if test -z "$ARFLAGS"; then + ARFLAGS='cru' + fi + fi + AC_SUBST([AR]) + AC_SUBST([ARFLAGS]) + if test -z "$RANLIB"; then + if test $gl_cv_c_amsterdam_compiler = yes; then + RANLIB=':' + else + dnl Use the ranlib program if it is available. + AC_PROG_RANLIB + fi + fi + AC_SUBST([RANLIB]) +]) + # AC_PROG_MKDIR_P # is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix # for interoperability with automake-1.9.6 from autoconf-2.62. diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 8c573e37..80d7893e 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -1,10 +1,22 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2011 Free Software Foundation, Inc. +# Copyright (C) 2002-2012 Free Software Foundation, Inc. # -# This file is free software, distributed under the terms of the GNU -# General Public License. As a special exception to the GNU General -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see <http://www.gnu.org/licenses/>. +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. @@ -25,28 +37,26 @@ AC_DEFUN([gl_EARLY], m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable - AC_REQUIRE([AC_PROG_RANLIB]) - # Code from module arg-nonnull: - # Code from module c++defs: + AC_REQUIRE([gl_PROG_AR_RANLIB]) # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) # Code from module include_next: # Code from module lib-ignore: + # Code from module snippet/arg-nonnull: + # Code from module snippet/c++defs: + # Code from module snippet/warn-on-use: # Code from module stddef: # Code from module string: # Code from module strndup: # Code from module strnlen: - # Code from module warn-on-use: ]) # This macro should be invoked from ./configure.ac, in the section # "Check for header files, types and library functions". AC_DEFUN([gl_INIT], [ - AM_CONDITIONAL([GL_COND_LIBTOOL], [false]) - gl_cond_libtool=false - gl_libdeps= - gl_ltlibdeps= + AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) + gl_cond_libtool=true gl_m4_base='m4' m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) @@ -59,8 +69,15 @@ gl_IGNORE_UNUSED_LIBRARIES gl_STDDEF_H gl_HEADER_STRING_H gl_FUNC_STRNDUP +if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then + AC_LIBOBJ([strndup]) +fi gl_STRING_MODULE_INDICATOR([strndup]) gl_FUNC_STRNLEN +if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then + AC_LIBOBJ([strnlen]) + gl_PREREQ_STRNLEN +fi gl_STRING_MODULE_INDICATOR([strnlen]) # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ @@ -139,10 +156,6 @@ changequote([, ])dnl AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) ]) - LIBGNU_LIBDEPS="$gl_libdeps" - AC_SUBST([LIBGNU_LIBDEPS]) - LIBGNU_LTLIBDEPS="$gl_ltlibdeps" - AC_SUBST([LIBGNU_LTLIBDEPS]) ]) # Like AC_LIBOBJ, except that the module name goes @@ -202,9 +215,9 @@ AC_DEFUN([gltests_LIBSOURCES], [ # This macro records the list of files which have been installed by # gnulib-tool and may be removed by future gnulib-tool invocations. AC_DEFUN([gl_FILE_LIST], [ - build-aux/arg-nonnull.h - build-aux/c++defs.h - build-aux/warn-on-use.h + build-aux/snippet/arg-nonnull.h + build-aux/snippet/c++defs.h + build-aux/snippet/warn-on-use.h lib/dummy.c lib/stddef.in.h lib/string.in.h diff --git a/m4/gnulib-tool.m4 b/m4/gnulib-tool.m4 index ed41e9d4..a09ffc1d 100644 --- a/m4/gnulib-tool.m4 +++ b/m4/gnulib-tool.m4 @@ -1,5 +1,5 @@ # gnulib-tool.m4 serial 2 -dnl Copyright (C) 2004-2005, 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2005, 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/include_next.m4 b/m4/include_next.m4 index b3c78491..a60a2614 100644 --- a/m4/include_next.m4 +++ b/m4/include_next.m4 @@ -1,5 +1,5 @@ -# include_next.m4 serial 18 -dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. +# include_next.m4 serial 23 +dnl Copyright (C) 2006-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -143,7 +143,7 @@ choke me # even if the compiler does not support include_next. # The three "///" are to pacify Sun C 5.8, which otherwise would say # "warning: #include of /usr/include/... may be non-portable". -# Use `""', not `<>', so that the /// cannot be confused with a C99 comment. +# Use '""', not '<>', so that the /// cannot be confused with a C99 comment. # Note: This macro assumes that the header file is not empty after # preprocessing, i.e. it does not only define preprocessor macros but also # provides some type/enum definitions or function/variable declarations. @@ -175,11 +175,13 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], [AC_CHECK_HEADERS_ONCE([$1]) ]) +dnl FIXME: gl_next_header and gl_header_exists must be used unquoted +dnl until we can assume autoconf 2.64 or newer. m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], [gl_cv_next_]m4_defn([gl_HEADER_NAME])) if test $gl_cv_have_include_next = yes; then - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) else AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], @@ -205,33 +207,57 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], aix*) gl_absname_cpp="$ac_cpp -C" ;; *) gl_absname_cpp="$ac_cpp" ;; esac +changequote(,) + case "$host_os" in + mingw*) + dnl For the sake of native Windows compilers (excluding gcc), + dnl treat backslash as a directory separator, like /. + dnl Actually, these compilers use a double-backslash as + dnl directory separator, inside the + dnl # line "filename" + dnl directives. + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + dnl A sed expression that turns a string into a basic regular + dnl expression, for use within "/.../". + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' +changequote([,]) + gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ +changequote(,)dnl + s|^/[^/]|//&| +changequote([,])dnl + p + q + }' dnl eval is necessary to expand gl_absname_cpp. dnl Ultrix and Pyramid sh refuse to redirect output of eval, dnl so use subshell. - AS_VAR_SET([gl_next_header], + AS_VAR_SET(gl_next_header, ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | - sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ - s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# - s#^/[^/]#//&# - p - q - }'`'"']) + sed -n "$gl_absolute_header_sed"`'"']) m4_if([$2], [check], [else - AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) fi ]) ]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), - [AS_VAR_GET([gl_next_header])]) + [AS_VAR_GET(gl_next_header)]) if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'gl_HEADER_NAME'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) + gl_next_as_first_directive=AS_VAR_GET(gl_next_header) fi AC_SUBST( AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), diff --git a/m4/lib-ignore.m4 b/m4/lib-ignore.m4 index 1fdfdc07..292c4691 100644 --- a/m4/lib-ignore.m4 +++ b/m4/lib-ignore.m4 @@ -1,6 +1,6 @@ # If possible, ignore libraries that are not depended on. -dnl Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/onceonly.m4 b/m4/onceonly.m4 index 223071a2..275d73c4 100644 --- a/m4/onceonly.m4 +++ b/m4/onceonly.m4 @@ -1,9 +1,22 @@ -# onceonly.m4 serial 7 -dnl Copyright (C) 2002-2003, 2005-2006, 2008-2011 Free Software Foundation, +# onceonly.m4 serial 9 +dnl Copyright (C) 2002-2003, 2005-2006, 2008-2012 Free Software Foundation, dnl Inc. -dnl This file is free software, distributed under the terms of the GNU -dnl General Public License. As a special exception to the GNU General -dnl Public License, this file may be distributed as part of a program +dnl +dnl This file is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This file is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this file. If not, see <http://www.gnu.org/licenses/>. +dnl +dnl As a special exception to the GNU General Public License, +dnl this file may be distributed as part of a program dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. @@ -67,7 +80,7 @@ AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ [gl_func_list="$gl_func_list gl_FUNC_NAME"]) gl_FUNCS_EXPANSION AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), - [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.]) + [Define to 1 if you have the ']m4_defn([gl_FUNC_NAME])[' function.]) ]) AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) ]) diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index 1ae23443..cc116096 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -1,6 +1,6 @@ dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues. # stddef_h.m4 serial 4 -dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/m4/string_h.m4 b/m4/string_h.m4 index df8c4035..5677e092 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -1,11 +1,11 @@ # Configure a GNU-like replacement for <string.h>. -# Copyright (C) 2007-2011 Free Software Foundation, Inc. +# Copyright (C) 2007-2012 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 20 +# serial 21 # Written by Paul Eggert. @@ -27,9 +27,9 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], dnl guaranteed by C89. gl_WARN_ON_USE_PREPARE([[#include <string.h> ]], - [memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup - strncat strndup strnlen strpbrk strsep strcasestr strtok_r strerror_r - strsignal strverscmp]) + [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul + strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r + strerror_r strsignal strverscmp]) ]) AC_DEFUN([gl_STRING_MODULE_INDICATOR], @@ -43,6 +43,8 @@ AC_DEFUN([gl_STRING_MODULE_INDICATOR], AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], [ + GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) + GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) @@ -80,6 +82,8 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) + HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) diff --git a/m4/strndup.m4 b/m4/strndup.m4 index d8f00cab..bdde5fe1 100644 --- a/m4/strndup.m4 +++ b/m4/strndup.m4 @@ -1,5 +1,5 @@ -# strndup.m4 serial 18 -dnl Copyright (C) 2002-2003, 2005-2011 Free Software Foundation, Inc. +# strndup.m4 serial 20 +dnl Copyright (C) 2002-2003, 2005-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,13 +18,18 @@ AC_DEFUN([gl_FUNC_STRNDUP], fi if test $ac_cv_func_strndup = yes; then + HAVE_STRNDUP=1 # AIX 4.3.3, AIX 5.1 have a function that fails to add the terminating '\0'. AC_CACHE_CHECK([for working strndup], [gl_cv_func_strndup_works], [AC_RUN_IFELSE([ AC_LANG_PROGRAM([[#include <string.h> #include <stdlib.h>]], [[ #ifndef HAVE_DECL_STRNDUP - extern char *strndup (const char *, size_t); + extern + #ifdef __cplusplus + "C" + #endif + char *strndup (const char *, size_t); #endif char *s; s = strndup ("some longer string", 15); @@ -42,12 +47,9 @@ changequote(,)dnl changequote([,])dnl ])]) case $gl_cv_func_strndup_works in - *no) - REPLACE_STRNDUP=1 - AC_LIBOBJ([strndup]) - ;; + *no) REPLACE_STRNDUP=1 ;; esac else - AC_LIBOBJ([strndup]) + HAVE_STRNDUP=0 fi ]) diff --git a/m4/strnlen.m4 b/m4/strnlen.m4 index a1c59ac6..d97e3075 100644 --- a/m4/strnlen.m4 +++ b/m4/strnlen.m4 @@ -1,5 +1,5 @@ -# strnlen.m4 serial 12 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation, +# strnlen.m4 serial 13 +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2012 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -16,16 +16,14 @@ AC_DEFUN([gl_FUNC_STRNLEN], if test $ac_cv_have_decl_strnlen = no; then HAVE_DECL_STRNLEN=0 else - AC_FUNC_STRNLEN + m4_pushdef([AC_LIBOBJ], [:]) dnl Note: AC_FUNC_STRNLEN does AC_LIBOBJ([strnlen]). + AC_FUNC_STRNLEN + m4_popdef([AC_LIBOBJ]) if test $ac_cv_func_strnlen_working = no; then REPLACE_STRNLEN=1 fi fi - if test $HAVE_DECL_STRNLEN = 0 || test $REPLACE_STRNLEN = 1; then - AC_LIBOBJ([strnlen]) - gl_PREREQ_STRNLEN - fi ]) # Prerequisites of lib/strnlen.c. diff --git a/m4/warn-on-use.m4 b/m4/warn-on-use.m4 index e0d0f276..a77802eb 100644 --- a/m4/warn-on-use.m4 +++ b/m4/warn-on-use.m4 @@ -1,5 +1,5 @@ -# warn-on-use.m4 serial 2 -dnl Copyright (C) 2010-2011 Free Software Foundation, Inc. +# warn-on-use.m4 serial 5 +dnl Copyright (C) 2010-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is preserved. # some systems declare functions in the wrong header, then INCLUDES # should do likewise. # -# If you assume C89, then it is generally safe to assume declarations -# for functions declared in that standard (such as gets) without +# It is generally safe to assume declarations for functions declared +# in the intersection of C89 and C11 (such as printf) without # needing gl_WARN_ON_USE_PREPARE. AC_DEFUN([gl_WARN_ON_USE_PREPARE], [ @@ -27,6 +27,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), [Define to 1 if ]m4_defn([gl_decl])[ is declared even after undefining macros.])])dnl +dnl FIXME: gl_Symbol must be used unquoted until we can assume +dnl autoconf 2.64 or newer. for gl_func in m4_flatten([$2]); do AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl AC_CACHE_CHECK([whether $gl_func is declared without a macro], @@ -35,8 +37,8 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], [@%:@undef $gl_func (void) $gl_func;])], [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) - AS_VAR_IF(gl_Symbol, [yes], - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + AS_VAR_IF(gl_Symbol, [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) dnl shortcut - if the raw declaration exists, then set a cache dnl variable to allow skipping any later AC_CHECK_DECL efforts eval ac_cv_have_decl_$gl_func=yes]) diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4 index d2c03c42..534735d8 100644 --- a/m4/wchar_t.m4 +++ b/m4/wchar_t.m4 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2008-2012 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/src/check_hkl.c b/src/check_hkl.c index 649b86af..4927e60e 100644 --- a/src/check_hkl.c +++ b/src/check_hkl.c @@ -339,43 +339,44 @@ int main(int argc, char *argv[]) while ((c = getopt_long(argc, argv, "hy:p:", longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 0 : + case 0 : break; - case 2 : + case 2 : if ( sscanf(optarg, "%e", &rmin_fix) != 1 ) { ERROR("Invalid value for --rmin\n"); return 1; } break; - case 3 : + case 3 : if ( sscanf(optarg, "%e", &rmax_fix) != 1 ) { ERROR("Invalid value for --rmax\n"); return 1; } break; - case 4 : + case 4 : if ( sscanf(optarg, "%f", &sigma_cutoff) != 1 ) { ERROR("Invalid value for --sigma-cutoff\n"); return 1; } break; - default : + default : return 1; } diff --git a/src/cl-utils.c b/src/cl-utils.c index ae146ed0..71ff25b5 100644 --- a/src/cl-utils.c +++ b/src/cl-utils.c @@ -46,28 +46,71 @@ const char *clError(cl_int err) { switch ( err ) { - case CL_SUCCESS : return "no error"; - case CL_INVALID_PLATFORM : return "invalid platform"; - case CL_INVALID_KERNEL : return "invalid kernel"; - case CL_INVALID_ARG_INDEX : return "invalid argument index"; - case CL_INVALID_ARG_VALUE : return "invalid argument value"; - case CL_INVALID_MEM_OBJECT : return "invalid memory object"; - case CL_INVALID_SAMPLER : return "invalid sampler"; - case CL_INVALID_ARG_SIZE : return "invalid argument size"; - case CL_INVALID_COMMAND_QUEUE : return "invalid command queue"; - case CL_INVALID_CONTEXT : return "invalid context"; - case CL_INVALID_VALUE : return "invalid value"; - case CL_INVALID_EVENT_WAIT_LIST : return "invalid wait list"; - case CL_MAP_FAILURE : return "map failure"; - case CL_MEM_OBJECT_ALLOCATION_FAILURE : return "object allocation failure"; - case CL_OUT_OF_HOST_MEMORY : return "out of host memory"; - case CL_OUT_OF_RESOURCES : return "out of resources"; - case CL_INVALID_KERNEL_NAME : return "invalid kernel name"; - case CL_INVALID_KERNEL_ARGS : return "invalid kernel arguments"; - case CL_INVALID_WORK_GROUP_SIZE : return "invalid work group size"; - case CL_IMAGE_FORMAT_NOT_SUPPORTED : return "image format not supported"; - case CL_INVALID_WORK_DIMENSION : return "invalid work dimension"; - default : + + case CL_SUCCESS : + return "no error"; + + case CL_INVALID_PLATFORM : + return "invalid platform"; + + case CL_INVALID_KERNEL : + return "invalid kernel"; + + case CL_INVALID_ARG_INDEX : + return "invalid argument index"; + + case CL_INVALID_ARG_VALUE : + return "invalid argument value"; + + case CL_INVALID_MEM_OBJECT : + return "invalid memory object"; + + case CL_INVALID_SAMPLER : + return "invalid sampler"; + + case CL_INVALID_ARG_SIZE : + return "invalid argument size"; + + case CL_INVALID_COMMAND_QUEUE : + return "invalid command queue"; + + case CL_INVALID_CONTEXT : + return "invalid context"; + + case CL_INVALID_VALUE : + return "invalid value"; + + case CL_INVALID_EVENT_WAIT_LIST : + return "invalid wait list"; + + case CL_MAP_FAILURE : + return "map failure"; + + case CL_MEM_OBJECT_ALLOCATION_FAILURE : + return "object allocation failure"; + + case CL_OUT_OF_HOST_MEMORY : + return "out of host memory"; + + case CL_OUT_OF_RESOURCES : + return "out of resources"; + + case CL_INVALID_KERNEL_NAME : + return "invalid kernel name"; + + case CL_INVALID_KERNEL_ARGS : + return "invalid kernel arguments"; + + case CL_INVALID_WORK_GROUP_SIZE : + return "invalid work group size"; + + case CL_IMAGE_FORMAT_NOT_SUPPORTED : + return "image format not supported"; + + case CL_INVALID_WORK_DIMENSION : + return "invalid work dimension"; + + default : return "unknown error"; } } diff --git a/src/compare_hkl.c b/src/compare_hkl.c index 5846682f..b926c3ae 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -331,49 +331,51 @@ int main(int argc, char *argv[]) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'o' : + case 'o' : ratiofile = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 'u' : + case 'u' : config_unity = 1; break; - case 0 : + case 0 : break; - case 2 : + case 2 : if ( sscanf(optarg, "%e", &rmin_fix) != 1 ) { ERROR("Invalid value for --rmin\n"); return 1; } break; - case 3 : + case 3 : if ( sscanf(optarg, "%e", &rmax_fix) != 1 ) { ERROR("Invalid value for --rmax\n"); return 1; } break; - case 4 : + case 4 : config_shells = get_r_shell(optarg); break; - default : + default : return 1; + } } diff --git a/src/get_hkl.c b/src/get_hkl.c index 9f86f0f7..de5d74de 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -391,44 +391,46 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 't' : + case 't' : template = strdup(optarg); break; - case 'o' : + case 'o' : output = strdup(optarg); break; - case 'i' : + case 'i' : input_file = strdup(optarg); break; - case 'y' : + case 'y' : mero_str = strdup(optarg); break; - case 'w' : + case 'w' : holo_str = strdup(optarg); break; - case 'e' : + case 'e' : expand_str = strdup(optarg); break; - case 2 : + case 2 : adu_per_photon = strtof(optarg, NULL); have_adu_per_photon = 1; break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/hdfsee.c b/src/hdfsee.c index 22302ec8..613572a2 100644 --- a/src/hdfsee.c +++ b/src/hdfsee.c @@ -151,15 +151,16 @@ int main(int argc, char *argv[]) char *test; switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'p' : + case 'p' : peaks = strdup(optarg); break; - case 'i' : + case 'i' : boost = atoi(optarg); if ( boost < 1 ) { ERROR("Intensity boost must be a positive" @@ -168,7 +169,7 @@ int main(int argc, char *argv[]) } break; - case 'b' : + case 'b' : binning = atoi(optarg); if ( binning < 1 ) { ERROR("Binning must be a positive integer.\n"); @@ -176,19 +177,19 @@ int main(int argc, char *argv[]) } break; - case 'c' : + case 'c' : cscale = strdup(optarg); break; - case 'e' : + case 'e' : element = strdup(optarg); break; - case 'g' : + case 'g' : geometry = strdup(optarg); break; - case 2 : + case 2 : ring_size = strtod(optarg, &test); if ( test == optarg ) { ERROR("Ring size must be numerical.\n"); @@ -196,7 +197,7 @@ int main(int argc, char *argv[]) } break; - case 'r' : + case 'r' : config_showrings = 1; reslist = strdup(optarg); int nchar = strlen(reslist); @@ -219,10 +220,10 @@ int main(int argc, char *argv[]) } break; - case 0 : + case 0 : break; - default : + default : return 1; } diff --git a/src/partial_sim.c b/src/partial_sim.c index 31822eca..9e054675 100644 --- a/src/partial_sim.c +++ b/src/partial_sim.c @@ -341,47 +341,48 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'o' : + case 'o' : output_file = strdup(optarg); break; - case 'i' : + case 'i' : input_file = strdup(optarg); break; - case 'b' : + case 'b' : beamfile = strdup(optarg); break; - case 'p' : + case 'p' : cellfile = strdup(optarg); break; - case 'g' : + case 'g' : geomfile = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'n' : + case 'n' : n = atoi(optarg); break; - case 'r' : + case 'r' : save_file = strdup(optarg); break; - case 'j' : + case 'j' : n_threads = atoi(optarg); break; - case 'c' : + case 'c' : cnoise = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid cell noise value.\n"); @@ -389,15 +390,16 @@ int main(int argc, char *argv[]) } break; - case 2 : + case 2 : phist_file = strdup(optarg); break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/partialator.c b/src/partialator.c index 91f2ff99..4fa8c2bd 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -325,35 +325,36 @@ int main(int argc, char *argv[]) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'i' : + case 'i' : infile = strdup(optarg); break; - case 'g' : + case 'g' : geomfile = strdup(optarg); break; - case 'j' : + case 'j' : nthreads = atoi(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'o' : + case 'o' : outfile = strdup(optarg); break; - case 'n' : + case 'n' : n_iter = atoi(optarg); break; - case 'b' : + case 'b' : beam = get_beam_parameters(optarg); if ( beam == NULL ) { ERROR("Failed to load beam parameters" @@ -362,15 +363,16 @@ int main(int argc, char *argv[]) } break; - case 'r' : + case 'r' : reference_file = strdup(optarg); break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/pattern_sim.c b/src/pattern_sim.c index c207e0dc..03b009b4 100644 --- a/src/pattern_sim.c +++ b/src/pattern_sim.c @@ -294,15 +294,16 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'r' : + case 'r' : config_randomquat = 1; break; - case 'n' : + case 'n' : n_images = strtol(optarg, &rval, 10); if ( *rval != '\0' ) { ERROR("Invalid number of images.\n"); @@ -310,43 +311,43 @@ int main(int argc, char *argv[]) } break; - case 'i' : + case 'i' : intfile = strdup(optarg); break; - case 't' : + case 't' : grad_str = strdup(optarg); break; - case 'p' : + case 'p' : filename = strdup(optarg); break; - case 'o' : + case 'o' : outfile = strdup(optarg); break; - case 'w' : + case 'w' : powder_fn = strdup(optarg); break; - case 'g' : + case 'g' : geometry = strdup(optarg); break; - case 'b' : + case 'b' : beamfile = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 2 : + case 2 : gpu_dev = atoi(optarg); break; - case 3 : + case 3 : min_size = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid minimum size.\n"); @@ -355,7 +356,7 @@ int main(int argc, char *argv[]) random_size++; break; - case 4 : + case 4 : max_size = strtod(optarg, &rval); if ( *rval != '\0' ) { ERROR("Invalid maximum size.\n"); @@ -364,11 +365,12 @@ int main(int argc, char *argv[]) random_size++; break; - case 0 : + case 0 : break; - default : + default : return 1; + } } diff --git a/src/post-refinement.c b/src/post-refinement.c index cf7b2576..78c47d07 100644 --- a/src/post-refinement.c +++ b/src/post-refinement.c @@ -241,7 +241,7 @@ static void apply_shift(struct image *image, int k, double shift) { switch ( k ) { - case REF_DIV : + case REF_DIV : if ( isnan(shift) ) { ERROR("NaN divergence shift\n"); } else { @@ -250,23 +250,23 @@ static void apply_shift(struct image *image, int k, double shift) } break; - case REF_R : + case REF_R : image->profile_radius += shift; break; - case REF_ASX : - case REF_ASY : - case REF_ASZ : - case REF_BSX : - case REF_BSY : - case REF_BSZ : - case REF_CSX : - case REF_CSY : - case REF_CSZ : + case REF_ASX : + case REF_ASY : + case REF_ASZ : + case REF_BSX : + case REF_BSY : + case REF_BSZ : + case REF_CSX : + case REF_CSY : + case REF_CSZ : apply_cell_shift(image->indexed_cell, k, shift); break; - default : + default : ERROR("No shift defined for parameter %i\n", k); abort(); diff --git a/src/powder_plot.c b/src/powder_plot.c index 3f49695a..049b9c0e 100644 --- a/src/powder_plot.c +++ b/src/powder_plot.c @@ -775,51 +775,51 @@ int main(int argc, char *argv[]) switch (c) { - case 'h' : + case 'h' : show_help(argv[0]); return 0; - case 'i' : + case 'i' : filename = strdup(optarg); break; - case 'o' : + case 'o' : output = strdup(optarg); break; - case 'g' : + case 'g' : geometry = strdup(optarg); break; - case 'b' : + case 'b' : beamf = strdup(optarg); break; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 's' : + case 's' : hist_info.histsize = atoi(optarg); break; - case 'e' : + case 'e' : element = strdup(optarg); break; - case 1 : + case 1 : hist_info.q_max = atof(optarg); break; - case 2 : + case 2 : hist_info.q_min = atof(optarg); break; - case 3 : + case 3 : if (strcmp(optarg, "linear") == 0 ) { hist_info.spacing = LINEAR; } else if (strcmp(optarg, "wilson") == 0 ) { @@ -832,14 +832,14 @@ int main(int argc, char *argv[]) } break; - case 'd' : + case 'd' : datatype = strdup(optarg); break; - case 0 : + case 0 : break; - default : + default : return 1; } @@ -1096,45 +1096,50 @@ int main(int argc, char *argv[]) } /* Process reflections based on file type and data type */ - switch (file_type) { - case FILE_H5 : + switch ( file_type ) { + case FILE_H5 : n_patterns++; n_peaks = process_h5(&image, &hist_info, histdata); free(image.data); break; - case FILE_HKL : + case FILE_HKL : n_patterns++; //inc number of patterns used n_peaks = process_hkl(&image, sym, cell, &hist_info, histdata, q_scaling, use_redundancy); break; - case FILE_STREAM : - switch (data_type) { - case PLOT_REFL : + case FILE_STREAM : + switch ( data_type ) { + + case PLOT_REFL : n_peaks = process_stream_reflection(fh, &image, &hist_info, histdata, &n_patterns); break; - case PLOT_HKL : + + case PLOT_HKL : n_peaks = process_stream_hkl(fh, &image, &hist_info, + histdata, cell, &n_patterns); break; - case PLOT_PEAKS : + case PLOT_PEAKS : n_peaks = process_stream_peaks(fh, &image, &hist_info, histdata, &n_patterns, only_indexed); break; - case PLOT_H5 : + + case PLOT_H5 : n_peaks = process_stream_h5(fh, &image, &hist_info, histdata, config_satcorr, only_indexed, &n_patterns, element); break; - default : + + default : break; } fclose(fh); break; - default : + default : break; } diff --git a/src/render_hkl.c b/src/render_hkl.c index a63cbad3..a01e7609 100644 --- a/src/render_hkl.c +++ b/src/render_hkl.c @@ -118,23 +118,29 @@ static double max_value(RefList *list, int wght, const SymOpList *sym) n = num_equivs(sym, m); switch ( wght ) { - case WGHT_I : + + case WGHT_I : val = get_intensity(refl); break; - case WGHT_SQRTI : + + case WGHT_SQRTI : val = get_intensity(refl); val = (val>0.0) ? sqrt(val) : 0.0; break; - case WGHT_COUNTS : + + case WGHT_COUNTS : val = get_redundancy(refl); val /= (double)n; break; - case WGHT_RAWCOUNTS : + + case WGHT_RAWCOUNTS : val = get_redundancy(refl); break; - default : + + default : ERROR("Invalid weighting.\n"); abort(); + } if ( val > max ) max = val; @@ -192,23 +198,29 @@ static void draw_circles(double xh, double xk, double xl, yi = (h*yh + k*yk + l*yl) / ny; switch ( wght) { - case WGHT_I : + + case WGHT_I : val = get_intensity(refl); break; - case WGHT_SQRTI : + + case WGHT_SQRTI : val = get_intensity(refl); val = (val>0.0) ? sqrt(val) : 0.0; break; - case WGHT_COUNTS : + + case WGHT_COUNTS : val = get_redundancy(refl); val /= (double)n; break; - case WGHT_RAWCOUNTS : + + case WGHT_RAWCOUNTS : val = get_redundancy(refl); break; - default : + + default : ERROR("Invalid weighting.\n"); abort(); + } /* Absolute location in image based on 2D basis */ @@ -621,43 +633,44 @@ int main(int argc, char *argv[]) longopts, NULL)) != -1) { switch (c) { - case 'h' : + + case 'h' : show_help(argv[0]); return 0; - case 'p' : + case 'p' : pdb = strdup(optarg); break; - case 'b' : + case 'b' : boost = atof(optarg); break; - case 'y' : + case 'y' : sym_str = strdup(optarg); break; - case 'w' : + case 'w' : weighting = strdup(optarg); break; - case 'c' : + case 'c' : cscale = strdup(optarg); break; - case 'd' : + case 'd' : down = strdup(optarg); break; - case 'r' : + case 'r' : right = strdup(optarg); break; - case 'o' : + case 'o' : outfile = strdup(optarg); break; - case 2 : + case 2 : errno = 0; scale_top = strtod(optarg, &endptr); if ( !( (optarg[0] != '\0') && (endptr[0] == '\0') ) @@ -672,11 +685,12 @@ int main(int argc, char *argv[]) } break; - case 0 : + case 0 : break; - default : + default : return 1; + } } |