Commit 63f8b6c5 authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Fixed typos introduced in the 2.4 LevMar custom update.

Added support for 64 bit binary table elements in FITS library (thanks to J.P. McFarland).
parent 534cebef
......@@ -6587,6 +6587,116 @@ AC_SUBST([SED])
AC_MSG_RESULT([$SED])
])
# longlong.m4 serial 13
dnl Copyright (C) 1999-2007 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.
dnl From Paul Eggert.
# Define HAVE_LONG_LONG_INT if 'long long int' works.
# This fixes a bug in Autoconf 2.61, but can be removed once we
# assume 2.62 everywhere.
# Note: If the type 'long long int' exists but is only 32 bits large
# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
# defined. In this case you can treat 'long long int' like 'long int'.
AC_DEFUN([AC_TYPE_LONG_LONG_INT],
[
AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
[AC_LINK_IFELSE(
[_AC_TYPE_LONG_LONG_SNIPPET],
[dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
dnl If cross compiling, assume the bug isn't important, since
dnl nobody cross compiles for this platform as far as we know.
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[@%:@include <limits.h>
@%:@ifndef LLONG_MAX
@%:@ define HALF \
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
@%:@ define LLONG_MAX (HALF - 1 + HALF)
@%:@endif]],
[[long long int n = 1;
int i;
for (i = 0; ; i++)
{
long long int m = n << i;
if (m >> i != n)
return 1;
if (LLONG_MAX / 2 < m)
break;
}
return 0;]])],
[ac_cv_type_long_long_int=yes],
[ac_cv_type_long_long_int=no],
[ac_cv_type_long_long_int=yes])],
[ac_cv_type_long_long_int=no])])
if test $ac_cv_type_long_long_int = yes; then
AC_DEFINE([HAVE_LONG_LONG_INT], 1,
[Define to 1 if the system has the type `long long int'.])
fi
])
# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
# This fixes a bug in Autoconf 2.61, but can be removed once we
# assume 2.62 everywhere.
# Note: If the type 'unsigned long long int' exists but is only 32 bits
# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
# will not be defined. In this case you can treat 'unsigned long long int'
# like 'unsigned long int'.
AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
[
AC_CACHE_CHECK([for unsigned long long int],
[ac_cv_type_unsigned_long_long_int],
[AC_LINK_IFELSE(
[_AC_TYPE_LONG_LONG_SNIPPET],
[ac_cv_type_unsigned_long_long_int=yes],
[ac_cv_type_unsigned_long_long_int=no])])
if test $ac_cv_type_unsigned_long_long_int = yes; then
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
[Define to 1 if the system has the type `unsigned long long int'.])
fi
])
# Expands to a C program that can be used to test for simultaneous support
# of 'long long' and 'unsigned long long'. We don't want to say that
# 'long long' is available if 'unsigned long long' is not, or vice versa,
# because too many programs rely on the symmetry between signed and unsigned
# integer types (excluding 'bool').
AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
[
AC_LANG_PROGRAM(
[[/* Test preprocessor. */
#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
error in preprocessor;
#endif
#if ! (18446744073709551615ULL <= -1ull)
error in preprocessor;
#endif
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
? 1 : -1)];
int i = 63;]],
[[/* Test availability of runtime routines for shift and division. */
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));]])
])
# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
......
......@@ -83,6 +83,9 @@
/* Define to 1 if you have the `logf' function. */
#undef HAVE_LOGF
/* Define to 1 if the system has the type `long long int'. */
#undef HAVE_LONG_LONG_INT
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
......@@ -153,6 +156,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if the system has the type `unsigned long long int'. */
#undef HAVE_UNSIGNED_LONG_LONG_INT
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for sextractor 2.9.7.
# Generated by GNU Autoconf 2.63 for sextractor 2.9.8.
#
# Report bugs to <bertin@iap.fr>.
#
......@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.9.7'
PACKAGE_STRING='sextractor 2.9.7'
PACKAGE_VERSION='2.9.8'
PACKAGE_STRING='sextractor 2.9.8'
PACKAGE_BUGREPORT='bertin@iap.fr'
 
ac_unique_file="src/makeit.c"
......@@ -1505,7 +1505,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures sextractor 2.9.7 to adapt to many kinds of systems.
\`configure' configures sextractor 2.9.8 to adapt to many kinds of systems.
 
Usage: $0 [OPTION]... [VAR=VALUE]...
 
......@@ -1575,7 +1575,7 @@ fi
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of sextractor 2.9.7:";;
short | recursive ) echo "Configuration of sextractor 2.9.8:";;
esac
cat <<\_ACEOF
 
......@@ -1706,7 +1706,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
sextractor configure 2.9.7
sextractor configure 2.9.8
generated by GNU Autoconf 2.63
 
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
......@@ -1720,7 +1720,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
 
It was created by sextractor $as_me 2.9.7, which was
It was created by sextractor $as_me 2.9.8, which was
generated by GNU Autoconf 2.63. Invocation command line was
 
$ $0 $@
......@@ -2423,7 +2423,7 @@ fi
 
# Define the identity of the package.
PACKAGE='sextractor'
VERSION='2.9.7'
VERSION='2.9.8'
 
 
cat >>confdefs.h <<_ACEOF
......@@ -21404,6 +21404,250 @@ _ACEOF
 
fi
 
{ $as_echo "$as_me:$LINENO: checking for long long int" >&5
$as_echo_n "checking for long long int... " >&6; }
if test "${ac_cv_type_long_long_int+set}" = set; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Test preprocessor. */
#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
error in preprocessor;
#endif
#if ! (18446744073709551615ULL <= -1ull)
error in preprocessor;
#endif
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
? 1 : -1)];
int i = 63;
int
main ()
{
/* Test availability of runtime routines for shift and division. */
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
if test "$cross_compiling" = yes; then
ac_cv_type_long_long_int=yes
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <limits.h>
#ifndef LLONG_MAX
# define HALF \
(1LL << (sizeof (long long int) * CHAR_BIT - 2))
# define LLONG_MAX (HALF - 1 + HALF)
#endif
int
main ()
{
long long int n = 1;
int i;
for (i = 0; ; i++)
{
long long int m = n << i;
if (m >> i != n)
return 1;
if (LLONG_MAX / 2 < m)
break;
}
return 0;
;
return 0;
}
_ACEOF
rm -f conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_try") 2>&5
ac_status=$?
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_long_long_int=yes
else
$as_echo "$as_me: program exited with status $ac_status" >&5
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_type_long_long_int=no
fi
rm -rf conftest.dSYM
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_long_long_int=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
$as_echo "$ac_cv_type_long_long_int" >&6; }
if test $ac_cv_type_long_long_int = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_LONG_LONG_INT 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking for unsigned long long int" >&5
$as_echo_n "checking for unsigned long long int... " >&6; }
if test "${ac_cv_type_unsigned_long_long_int+set}" = set; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Test preprocessor. */
#if ! (-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
error in preprocessor;
#endif
#if ! (18446744073709551615ULL <= -1ull)
error in preprocessor;
#endif
/* Test literals. */
long long int ll = 9223372036854775807ll;
long long int nll = -9223372036854775807LL;
unsigned long long int ull = 18446744073709551615ULL;
/* Test constant expressions. */
typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
? 1 : -1)];
typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
? 1 : -1)];
int i = 63;
int
main ()
{
/* Test availability of runtime routines for shift and division. */
long long int llmax = 9223372036854775807ll;
unsigned long long int ullmax = 18446744073709551615ull;
return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
| (llmax / ll) | (llmax % ll)
| (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
| (ullmax / ull) | (ullmax % ull));
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
ac_cv_type_unsigned_long_long_int=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_unsigned_long_long_int=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long_int" >&5
$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
if test $ac_cv_type_unsigned_long_long_int = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_UNSIGNED_LONG_LONG_INT 1
_ACEOF
fi
{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
if test "${ac_cv_struct_tm+set}" = set; then
......@@ -28291,7 +28535,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by sextractor $as_me 2.9.7, which was
This file was extended by sextractor $as_me 2.9.8, which was
generated by GNU Autoconf 2.63. Invocation command line was
 
CONFIG_FILES = $CONFIG_FILES
......@@ -28354,7 +28598,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
sextractor config.status 2.9.7
sextractor config.status 2.9.8
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
......
......@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)
# This is your standard Bertin source code...
AC_INIT(sextractor, 2.9.7, [bertin@iap.fr])
AC_INIT(sextractor, 2.9.8, [bertin@iap.fr])
AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf)
AM_CONFIG_HEADER(config.h)
......@@ -82,6 +82,8 @@ fi
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_STRUCT_TM
AC_TYPE_UID_T
......
.TH SEXTRACTOR "1" "October 2009" "SWarp 2.9.7" "User Commands"
.TH SEXTRACTOR "1" "November 2009" "SWarp 2.9.8" "User Commands"
.SH NAME
sex \- extract a source catalog from an astronomical FITS image
.SH SYNOPSIS
......
......@@ -9,7 +9,7 @@
*
* Contents: Handle memory allocation for FITS bodies.
*
* Last modify: 10/10/2007
* Last modify: 02/11/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -191,7 +191,7 @@ INPUT A pointer to the tab structure,
OUTPUT -.
NOTES .
AUTHOR E. Bertin (IAP)
VERSION 10/10/2007
VERSION 02/11/2009
***/
void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{
......@@ -202,6 +202,8 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
cval, cblank;
unsigned short suval, sublank;
short val16, sval, sblank;
ULONGLONG lluval, llublank;
LONGLONG llval, llblank;
unsigned int iuval, iublank;
int curval, dval, blankflag, ival, iblank;
......@@ -321,6 +323,38 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
}
break;
#ifdef HAVE_LONG_LONG_INT
case BP_LONGLONG:
if (bswapflag)
swapbytes(bufdata, 8, spoonful);
if (blankflag)
{
if (tab->bitsgn)
{
llblank = (LONGLONG)tab->blank;
for (i=spoonful; i--; bufdata += sizeof(LONGLONG))
*(ptr++) = ((llval = *((LONGLONG *)bufdata)) == llblank)?
-BIG : ival*bs + bz;
}
else
{
llublank = (ULONGLONG)tab->blank;
for (i=spoonful; i--; bufdata += sizeof(ULONGLONG))
*(ptr++) = ((lluval = *((ULONGLONG *)bufdata)) == llublank)?
-BIG : iuval*bs + bz;
}
}
else
{
if (tab->bitsgn)
for (i=spoonful; i--; bufdata += sizeof(LONGLONG))
*(ptr++) = *((LONGLONG *)bufdata)*bs + bz;
else
for (i=spoonful; i--; bufdata += sizeof(ULONGLONG))
*(ptr++) = *((ULONGLONG *)bufdata)*bs + bz;
}
break;
#endif
case BP_FLOAT:
if (bswapflag)
swapbytes(bufdata, 4, spoonful);
......@@ -328,7 +362,6 @@ void read_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
*(ptr++) = ((0x7f800000&*(unsigned int *)bufdata) == 0x7f800000)?
-BIG : *((float *)bufdata)*bs + bz;
break;
case BP_DOUBLE:
if (bswapflag)
{
......@@ -463,7 +496,7 @@ INPUT A pointer to the tab structure,
OUTPUT -.
NOTES .
AUTHOR E. Bertin (IAP)
VERSION 11/10/2007
VERSION 02/11/2009
***/
void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
{
......@@ -510,6 +543,14 @@ void read_ibody(tabstruct *tab, FLAGTYPE *ptr, size_t size)
*(ptr++) = (FLAGTYPE)*((unsigned long *)bufdata);
break;
#ifdef HAVE_LONG_LONG_INT
case BP_LONGLONG:
if (bswapflag)
swapbytes(bufdata, 8, spoonful);
for (i=spoonful; i--; bufdata += sizeof(ULONGLONG))
*(ptr++) = (FLAGTYPE)*((ULONGLONG *)bufdata);
break;
#endif
case BP_FLOAT:
case BP_DOUBLE:
error(EXIT_FAILURE,"*Error*: I was expecting integers in ",
......@@ -631,7 +672,7 @@ INPUT A pointer to the tab structure,
OUTPUT -.
NOTES .
AUTHOR E. Bertin (IAP)
VERSION 11/10/2007
VERSION 02/11/2009
***/
void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
{
......@@ -711,6 +752,24 @@ void write_body(tabstruct *tab, PIXTYPE *ptr, size_t size)
swapbytes(cbufdata0, 4, spoonful);
break;
#ifdef HAVE_LONG_LONG_INT
case BP_LONGLONG:
if (tab->bitsgn)
{
LONGLONG *bufdata = (LONGLONG *)cbufdata0;
for (i=spoonful; i--;)
*(bufdata++) = (LONGLONG)((*(ptr++)-bz)/bs+0.49999);
}
else
{
ULONGLONG *bufdata = (ULONGLONG *)cbufdata0;
for (i=spoonful; i--;)
*(bufdata++) = (ULONGLONG)((*(ptr++)-bz)/bs+0.49999);
}
if (bswapflag)
swapbytes(cbufdata0, 8, spoonful);
break;
#endif
case BP_FLOAT:
{
float *bufdata = (float *)cbufdata0;
......
......@@ -7,9 +7,9 @@
*
* Author: E.BERTIN, DeNIS/LDAC
*
* Contents: Simplified versin of the LDACTools: main include file
* Contents: Simplified version of the LDACTools: main include file
*
* Last modify: 10/10/2007
* Last modify: 02/11/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -41,6 +41,7 @@
#define BP_BYTE 8
#define BP_SHORT 16
#define BP_LONG 32
#define BP_LONGLONG 64
#define BP_FLOAT (-32)
#define BP_DOUBLE (-64)
......@@ -67,7 +68,8 @@
typedef enum {H_INT, H_FLOAT, H_EXPO, H_BOOL, H_STRING, H_STRINGS,
H_COMMENT, H_HCOMMENT, H_KEY} h_type;
/* type of FITS-header data */
typedef enum {T_BYTE, T_SHORT, T_LONG, T_FLOAT, T_DOUBLE, T_STRING}
typedef enum {T_BYTE, T_SHORT, T_LONG, T_LONGLONG,
T_FLOAT, T_DOUBLE, T_STRING}
t_type; /* Type of data */
typedef enum {WRITE_ONLY, READ_ONLY}
access_type; /* Type of access */
......@@ -77,15 +79,19 @@ typedef enum {SHOW_ASCII, SHOW_SKYCAT}
typedef float PIXTYPE; /* Pixel type */
typedef unsigned int FLAGTYPE; /* Flag type */
#ifdef HAVE_UNSIGNED_LONG_LONG
typedef unsigned long long KINGSIZE_T; /* for large sizes */
#ifdef HAVE_UNSIGNED_LONG_LONG_INT
typedef unsigned long long KINGSIZE_T; /* for large sizes */
typedef unsigned long long ULONGLONG;
#else
typedef size_t KINGSIZE_T; /* better than nothing */
typedef size_t KINGSIZE_T;/* better than nothing */
typedef union {unsigned int l[2];} ULONGLONG;
#endif
#ifdef HAVE_LONG_LONG
typedef long long KINGLONG; /* for large sizes */
#ifdef HAVE_LONG_LONG_INT
typedef long long KINGLONG; /* for large sizes */
typedef long long LONGLONG;
#else
typedef long KINGLONG; /* better than nothing */
typedef long KINGLONG;/* better than nothing */
typedef union {int l[2];} LONGLONG;
#endif
#if _FILE_OFFSET_BITS
......
......@@ -9,10 +9,15 @@
*
* Contents: functions for converting LDAC FITS catalogs.
*
* Last modify: 25/09/2004
* Last modify: 02/11/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -128,15 +133,42 @@ INPUT Pointer to element to convert,
OUTPUT -.
NOTES ttypeconv does not yet handle arrays.
AUTHOR E. Bertin (IAP)
VERSION 25/09/2004
VERSION 02/11/2009
***/
void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout)
{
union {char tbyte; short tshort; int tlong; float tfloat;
double tdouble; char tstring;} ival;
union {char tbyte; short tshort; int tlong; LONGLONG tlonglong;
float tfloat; double tdouble; char tstring;} ival;
#ifdef HAVE_LONG_LONG_INT
#define OUTCONV(x, y) \
switch(y) \
{ \
case T_BYTE: \
case T_STRING: \
*((char *)ptrout) = (char)x; \
break; \
case T_SHORT: \
*((short *)ptrout) = (short)x; \
break; \
case T_LONG: \
*((int *)ptrout) = (int)x; \
break; \
case T_LONGLONG: \
*((LONGLONG *)ptrout) = (LONGLONG)x; \
break; \
case T_FLOAT: \
*((float *)ptrout) = (float)x; \
break; \
case T_DOUBLE: \
*((double *)ptrout) = (double)x; \
break; \
default: \
break; \
}
#else
#define OUTCONV(x, y) \
switch(y) \
{ \
......@@ -159,29 +191,30 @@ void ttypeconv(void *ptrin, void *ptrout, t_type ttypein, t_type ttypeout)
default: \
break; \
}
#endif
switch(ttypein)
{
case T_BYTE:
case T_STRING:
ival.tbyte = *(char *)ptrin;
OUTCONV(ival.tbyte, ttypeout);
OUTCONV(*(char *)ptrin, ttypeout);
break;
case T_SHORT:
ival.tshort = *(short *)ptrin;
OUTCONV(ival.tshort, ttypeout);
OUTCONV(*(short *)ptrin, ttypeout);
break;
case T_LONG:
ival.tlong = *(int *)ptrin;
OUTCONV(ival.tlong, ttypeout);
OUTCONV(*(int *)ptrin, ttypeout);
break;
#ifdef HAVE_LONG_LONG_INT
case T_LONGLONG:
OUTCONV(*(LONGLONG *)ptrin, ttypeout);
break;
#endif
case T_FLOAT:
ival.tfloat = *(float *)ptrin;
OUTCONV(ival.tfloat, ttypeout);
OUTCONV(*(float *)ptrin, ttypeout);
break;
case T_DOUBLE:
ival.tdouble = *(double *)ptrin;
OUTCONV(ival.tdouble, ttypeout);
OUTCONV(*(double *)ptrin, ttypeout);
break;
default:
break;
......
......@@ -9,7 +9,7 @@
*
* Contents: general functions for handling FITS file headers.
*
* Last modify: 20/06/2007
* Last modify: 28/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -26,7 +26,7 @@
#include "fitscat.h"
extern char histokeys[][12];
const int t_size[] = {1, 2, 4, 4, 8, 1}; /* size in bytes per t_type */
const int t_size[] = {1, 2, 4, 8, 4, 8, 1};/* size in bytes per t_type */
/******* get_head *************************************************************
PROTO int get_head(tabstruct *tab)
......@@ -187,7 +187,7 @@ OUTPUT RETURN_OK if a binary table was found and mapped, RETURN_ERROR
otherwise.
NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 25/09/2004
VERSION 28/10/2009
***/
int readbintabparam_head(tabstruct *tab)
......@@ -260,6 +260,7 @@ int readbintabparam_head(tabstruct *tab)
case T_BYTE:
case T_SHORT:
case T_LONG:
case T_LONGLONG:
key->htype = H_INT;
break;
case T_FLOAT:
......@@ -618,7 +619,7 @@ INPUT a char pointer (to be filled with the T_FORM string),
OUTPUT RETURN_OK if everything went as expected, or RETURN_ERROR otherwise.
NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 08/02/96
VERSION 28/10/2009
***/
int tformof(char *str, t_type ttype, int n)
......@@ -633,6 +634,8 @@ int tformof(char *str, t_type ttype, int n)
break;
case T_LONG: t = 'J';
break;
case T_LONGLONG: t = 'K';
break;
case T_FLOAT: t = 'E';
break;
case T_DOUBLE: t = 'D';
......@@ -655,7 +658,7 @@ INPUT TFORM string (see the FITS documentation).
OUTPUT size in bytes, or RETURN_ERROR if the TFORM is unknown.
NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 08/02/96
VERSION 28/10/2009
***/
int tsizeof(char *str)
......@@ -669,13 +672,13 @@ int tsizeof(char *str)
switch ((int)*str2)
{
case 'L': case 'B': case 'A': return n;
case 'X': return (n-1)/8+1;
case 'I': return 2*n;
case 'J': case 'E': return 4*n;
case 'C': case 'D': case 'P': return 8*n;
case 'M': return 16*n;
default: return RETURN_ERROR;
case 'L': case 'B': case 'A': return n;
case 'X': return (n-1)/8+1;
case 'I': return 2*n;
case 'J': case 'E': return 4*n;
case 'C': case 'D': case 'K': case 'P': return 8*n;
case 'M': return 16*n;
default: return RETURN_ERROR;
}
}
......@@ -688,7 +691,7 @@ INPUT TFORM string (see the FITS documentation).
OUTPUT size in bytes, or RETURN_ERROR if the TFORM is unknown.
NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 17/03/2002
VERSION 28/10/2009
***/
t_type ttypeof(char *str)
......@@ -702,6 +705,7 @@ t_type ttypeof(char *str)
case 'L': case 'B': case 'X': return T_BYTE;
case 'I': return T_SHORT;
case 'J': return T_LONG;
case 'K': return T_LONGLONG;
case 'E': return T_FLOAT;
case 'D': return T_DOUBLE;
case 'A': return T_STRING;
......
......@@ -9,7 +9,7 @@
*
* Contents: Functions related to the management of keys.
*
* Last modify: 04/06/2007
* Last modify: 02/11/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -575,7 +575,7 @@ NOTES This is approximately the same code as for read_keys.
A NULL keynames pointer means read ALL keys belonging to the table.
A NULL mask pointer means NO selection for reading.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 04/06/2007
VERSION 02/11/2009
***/
void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys,
BYTE *mask, FILE *stream,
......@@ -845,6 +845,30 @@ void show_keys(tabstruct *tab, char **keynames, keystruct **keys, int nkeys,
}
break;
case T_LONGLONG:
for (j = 0; j<nelem; j++,ptr += esize)
{
if (key_col[k] == 0 || key_col[k] == j+1) {
#ifdef HAVE_LONG_LONG_INT
fprintf(stream, *key->printf?key->printf:"%lld",
*(LONGLONG *)ptr);
#else
fprintf(stream, *key->printf?key->printf:"%d",
*(int *)ptr);
#endif
if (j < nelem-1) {
switch (o_type) {
case SHOW_ASCII:
putc(' ', stream);
break;
case SHOW_SKYCAT:
putc('\t', stream);
break;
}
}
}
}
break;
case T_FLOAT:
for (j = 0; j<nelem; j++,ptr += esize)
{
......
......@@ -9,7 +9,7 @@
*
* Contents: general functions for handling LDAC FITS catalogs.
*
* Last modify: 15/08/2003
* Last modify: 28/10/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -36,7 +36,7 @@ NOTES -.
AUTHOR E.R. Deul(Leiden observatory),
E. Bertin (IAP & Leiden observatory): return value modified.
E.R. Deul(Leiden observatory): output units
VERSION 15/08/2003
VERSION 28/10/2009
***/
int about_tab(catstruct *cat, char *tabname, FILE *stream)
{
......@@ -60,6 +60,7 @@ int about_tab(catstruct *cat, char *tabname, FILE *stream)
case T_BYTE: fprintf(stream,"Byte"); break;
case T_SHORT: fprintf(stream,"Short Int"); break;
case T_LONG: fprintf(stream,"Long Int"); break;
case T_LONGLONG: fprintf(stream,"Long Long Int"); break;
case T_FLOAT: fprintf(stream,"Float"); break;
case T_DOUBLE: fprintf(stream,"Double"); break;
case T_STRING: fprintf(stream,"String"); break;
......
......@@ -9,7 +9,7 @@
*
* Contents: functions for handling FITS keywords.
*
* Last modify: 22/05/2009
* Last modify: 02/11/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -310,7 +310,7 @@ INPUT pointer to the FITS buffer,
OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise.
NOTES The buffer MUST contain the ``END '' keyword.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 04/08/2004
VERSION 02/11/2009
***/
int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
t_type ttype)
......@@ -328,10 +328,14 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
switch(htype)
{
case H_INT: if (ttype == T_SHORT)
case H_INT: if (ttype == T_LONG)
sscanf(str+10, " %d", (LONG *)ptr);
else if (ttype == T_SHORT)
sscanf(str+10, " %hd", (short *)ptr);
#ifdef HAVE_LONG_LONG_INT
else
sscanf(str+10, " %d", (LONG *)ptr);
sscanf(str+10, " %lld", (LONGLONG *)ptr);
#endif
break;
case H_FLOAT:
......@@ -347,8 +351,12 @@ int fitsread(char *fitsbuf, char *keyword, void *ptr, h_type htype,
*(BYTE *)ptr = ((int)s[0] == 'T') ? 1 : 0;
else if (ttype == T_SHORT)
*(short *)ptr = ((int)s[0] == 'T') ? 1 : 0;
else
else if (ttype == T_LONG)
*(LONG *)ptr = ((int)s[0] == 'T') ? 1 : 0;
#ifdef HAVE_LONG_LONG_INT
else
*(LONGLONG *)ptr = ((int)s[0] == 'T') ? 1 : 0;
#endif
break;
case H_STRING: st = ptr;
......@@ -439,7 +447,7 @@ OUTPUT RETURN_OK if the keyword was found, RETURN_ERROR otherwise.
NOTES The buffer MUST contain the ``END '' keyword.
The keyword must already exist in the buffer (use fitsadd()).
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 21/09/2006
VERSION 02/11/2009
***/
int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype,
t_type ttype)
......@@ -458,8 +466,14 @@ int fitswrite(char *fitsbuf, char *keyword, void *ptr, h_type htype,
fitsbuf += 80*pos;
switch(htype)
{
case H_INT: sprintf(str, "%20d", (ttype==T_SHORT)?
*(short *)ptr: *(int *)ptr);
case H_INT: if (ttype==T_LONG)
sprintf(str, "%20d", *(int *)ptr);
else if (ttype==T_SHORT)
sprintf(str, "%20d", *(short *)ptr);
#ifdef HAVE_LONG_LONG_INT
else
sprintf(str, "%20lld", *(LONGLONG *)ptr);
#endif
break;
case H_FLOAT: sprintf(str, " %12.4f", (ttype==T_DOUBLE)?
......
......@@ -9,7 +9,7 @@
*
* Contents: low-level functions for writing LDAC FITS catalogs.
*
* Last modify: 17/07/2006
* Last modify: 02/11/2009
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
......@@ -386,7 +386,7 @@ INPUT Output stream
OUTPUT -.
NOTES -.
AUTHOR E. Bertin (IAP & Leiden observatory)
VERSION 12/07/2006
VERSION 02/11/2009
***/
void print_obj(FILE *stream, tabstruct *tab)
......@@ -425,6 +425,11 @@ void print_obj(FILE *stream, tabstruct *tab)
if (i)
putc(' ', stream);
break;
case T_LONGLONG:
fprintf(stream, *key->printf?key->printf:"%lld", *(LONGLONG *)ptr);
if (i)
putc(' ', stream);
break;
case T_BYTE:
if (key->htype==H_BOOL)
{
......@@ -463,7 +468,7 @@ INPUT Output stream
OUTPUT -.
NOTES -.
AUTHOR G. Tissier & E.Bertin (IAP)
VERSION 12/07/2006
VERSION 02/11/2009
***/
void voprint_obj(FILE *stream, tabstruct *tab)
......@@ -506,6 +511,11 @@ void voprint_obj(FILE *stream, tabstruct *tab)
if (i)
putc(' ', stream);
break;
case T_LONGLONG:
fprintf(stream, *key->printf?key->printf:"%lld", *(LONGLONG *)ptr);
if (i)
putc(' ', stream);
break;
case T_BYTE:
if (key->htype==H_BOOL)
{
......
......@@ -129,13 +129,13 @@ register LM_REAL sum;
tau_sz=m;
r_sz=m*m; /* only the upper triangular part really needed */
if(!nb){
LM_REAL tmp;
if(!nb){
LM_REAL tmp;
worksz=-1; // workspace query; optimal size is returned
GEQRF((int *)&m, (int *)&m, NULL, (int *)&m, NULL, (LM_
nb=((int)tmp)/m; // optimal worksize is m*nb
}
worksz=-1; // workspace query; optimal size is returned in tmp
GEQRF((int *)&m, (int *)&m, NULL, (int *)&m, NULL, (LM_REAL *)&tmp, (int *)&worksz, (int *)&info);
nb=((int)tmp)/m; // optimal worksize is m*nb
}
worksz=nb*m;
tot_sz=a_sz + qtb_sz + tau_sz + r_sz + worksz;
......@@ -302,8 +302,8 @@ register LM_REAL sum;
if(!nb){
LM_REAL tmp;
worksz=-1; // workspace query; optimal size is returned
GEQRF((int *)&m, (int *)&m, NULL, (int *)&m, NULL, (LM_
worksz=-1; // workspace query; optimal size is returned in tmp
GEQRF((int *)&m, (int *)&m, NULL, (int *)&m, NULL, (LM_REAL *)&tmp, (int *)&worksz, (int *)&info);
nb=((int)tmp)/m; // optimal worksize is m*nb
}
worksz=nb*m;
......@@ -490,15 +490,15 @@ int info, nrhs=1;
a=buf;
b=a+a_sz;
/* store A into a anb B into b. A is assumed symmetric,
* hence no transposition is needed
*/
for(i=0; i<m; i++){
a[i]=A[i];
b[i]=B[i];
}
for(i=m; i<m*m; i++)
a[i]=A[i];
/* store A into a anb B into b. A is assumed symmetric,
* hence no transposition is needed
*/
for(i=0; i<m; i++){
a[i]=A[i];
b[i]=B[i];
}
for(i=m; i<m*m; i++)
a[i]=A[i];
/* Cholesky decomposition of A */
//POTF2("U", (int *)&m, a, (int *)&m, (int *)&info);
......@@ -897,7 +897,7 @@ extern int GETRS(char *trans, int *n, int *nrhs, LM_REAL *a, int *lda, int *ipiv
int AX_EQ_B_LU(LM_REAL *A, LM_REAL *B, LM_REAL *x, int m)
{
__STATIC__ LM_REAL *buf=NULL;
__STATIC__ void *buf=NULL;
__STATIC__ int buf_sz=0;
int a_sz, ipiv_sz, b_sz, work_sz, tot_sz;
......@@ -935,7 +935,7 @@ LM_REAL *a, *b;
}
#else
buf_sz=tot_sz;
buf=(void *))malloc(buf_sz);
buf=(void *)malloc(buf_sz);
if(!buf){
fprintf(stderr, RCAT("memory allocation in ", AX_EQ_B_LU) "() failed!\n");
exit(1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment