Skip to content

Commit

Permalink
revert to CFITSIO for table i/o
Browse files Browse the repository at this point in the history
The libtbtables.a was changed in v2.16 to use SPP fitsio from earlier uses
of the fortran version under the assumption that they were equivalent.
However, there is a bug in the fortran version of ftdrow() when called
by the TDIFFER task in which the output table doesn't have its NAXIS2
value properly updated for FITS tables causing the task to exit.  The
cfitsio code acknowledges the value may not be correct and so uses an
internal data structure value for the 'nrows' rather than the keyword,
but equivalent functionality does not exist in the fortran version.  A
similar problem exists when inserting rows but this is not called from
any existing NTTOOLS tasks.

This change fixes a bug in the GEMINI.GSEEING task which is the only
task known to call TDIFFER.
  • Loading branch information
mjfitzpatrick authored and olebole committed Mar 11, 2024
1 parent 56f012d commit 40b284f
Show file tree
Hide file tree
Showing 132 changed files with 166,264 additions and 4 deletions.
46 changes: 46 additions & 0 deletions pkg/tbtables/cfitsio/Licence.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Copyright (Unpublished--all rights reserved under the copyright laws of
the United States), U.S. Government as represented by the Administrator
of the National Aeronautics and Space Administration. No copyright is
claimed in the United States under Title 17, U.S. Code.

Permission to freely use, copy, modify, and distribute this software
and its documentation without fee is hereby granted, provided that this
copyright notice and disclaimer of warranty appears in all copies.
(However, see the restriction on the use of the gzip compression code,
below).

DISCLAIMER:

THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,
EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,
ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE
DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE
SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY
DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY
CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY
PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED
FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR
SERVICES PROVIDED HEREUNDER.

The file compress.c contains (slightly modified) source code that
originally came from gzip-1.2.4, copyright (C) 1992-1993 by Jean-loup
Gailly. This gzip code is distributed under the GNU General Public
Licence and thus requires that any software that uses the CFITSIO
library (which in turn uses the gzip code) must conform to the
provisions in the GNU General Public License. A copy of the GNU
licence is included at the beginning of compress.c file.

An alternate version of the compress.c file (called compress_alternate.c)
is provided for users who want to use the CFITSIO library but are
unwilling or unable to publicly release their software under the terms
of the GNU General Public License. This alternate version contains
non-functional stubs for the file compression and uncompression
routines used by CFITSIO. Replace the file 'compress.c' with
'compress_alternate.c' before compiling the CFITSIO library. This will
produce a version of CFITSIO which does not support reading or writing
compressed FITS files but is otherwise identical to the standard
version.
145 changes: 145 additions & 0 deletions pkg/tbtables/cfitsio/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
#
# Makefile for cfitsio library:
# libcfits.a
#
# Oct-96 : original version by
#
# JDD/WDP
# NASA GSFC
# Oct 1996
#
# 25-Jan-01 : removed conditional drvrsmem.c compilation because this
# is now handled within the source file itself.
# 09-Mar-98 : modified to conditionally compile drvrsmem.c. Also
# changes to target all (deleted clean), added DEFS, LIBS, added
# DEFS to .c.o, added SOURCES_SHMEM and MY_SHMEM, expanded getcol*
# and putcol* in SOURCES, modified OBJECTS, mv changed to /bin/mv
# (to bypass aliasing), cp changed to /bin/cp, add smem and
# testprog targets. See also changes and comments in configure.in
#

CFITSIO_LIB = @CFITSIO_PREFIX@/lib
CFITSIO_INCLUDE = @CFITSIO_PREFIX@/include

SHELL = /bin/sh
RANLIB = @RANLIB@
CC = @CC@
CFLAGS = @CFLAGS@
FC = @FC@
LDFLAGS = $(CFLAGS)
DEFS = @DEFS@
LIBS = @LIBS@
FLEX = flex
BISON = bison

SHLIB_LD = @SHLIB_LD@
SHLIB_SUFFIX = @SHLIB_SUFFIX@

.c.o:
$(CC) -c $(CFLAGS) $(DEFS) $<


CORE_SOURCES = buffers.c cfileio.c checksum.c compress.c drvrfile.c drvrmem.c \
drvrnet.c drvrsmem.c editcol.c edithdu.c eval_l.c eval_y.c \
eval_f.c fitscore.c getcol.c getcolb.c getcold.c getcole.c \
getcoli.c getcolj.c getcolk.c getcoll.c getcols.c getcolsb.c \
getcoluk.c getcolui.c getcoluj.c getkey.c group.c grparser.c \
histo.c iraffits.c \
modkey.c putcol.c putcolb.c putcold.c putcole.c putcoli.c \
putcolj.c putcolk.c putcoluk.c putcoll.c putcols.c putcolsb.c \
putcolu.c putcolui.c putcoluj.c putkey.c region.c scalnull.c \
swapproc.c wcssub.c wcsutil.c imcompress.c quantize.c ricecomp.c \
pliocomp.c

SOURCES = ${CORE_SOURCES} @F77_WRAPPERS@

OBJECTS = ${SOURCES:.c=.o}

CORE_OBJECTS = ${CORE_SOURCES:.c=.o}


FITSIO_SRC = f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c

# ============ description of all targets =============
# - <<-- ignore error code

all:
@if [ "x${FC}" = x ]; then \
${MAKE} all-nofitsio; \
else \
${MAKE} stand_alone; \
fi

all-nofitsio:
${MAKE} stand_alone "FITSIO_SRC="

stand_alone: libcfitsio.a

libcfitsio.a: ${OBJECTS}
ar rv libcfitsio.a ${OBJECTS}; \
${RANLIB} libcfitsio.a;

shared: libcfitsio${SHLIB_SUFFIX}

libcfitsio${SHLIB_SUFFIX}: ${OBJECTS}
${SHLIB_LD} -o $@ ${OBJECTS}

install: libcfitsio.a ${CFITSIO_LIB} ${CFITSIO_INCLUDE}
@if [ -f libcfitsio.a ]; then \
/bin/mv libcfitsio.a ${CFITSIO_LIB}; \
fi; \
if [ -f libcfitsio${SHLIB_SUFFIX} ]; then \
/bin/mv libcfitsio${SHLIB_SUFFIX} ${CFITSIO_LIB}; \
fi; \
/bin/cp fitsio.h fitsio2.h longnam.h drvrsmem.h ${CFITSIO_INCLUDE}/

smem: smem.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o smem smem.o -L. -lcfitsio -lm

testprog: testprog.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o testprog testprog.o -L. -lcfitsio -lm ${LIBS}

fitscopy: fitscopy.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o fitscopy fitscopy.o -L. -lcfitsio -lm ${LIBS}

speed: speed.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o speed speed.o -L. -lcfitsio -lm ${LIBS}

imcopy: imcopy.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o imcopy imcopy.o -L. -lcfitsio -lm ${LIBS}

listhead: listhead.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o listhead listhead.o -L. -lcfitsio -lm ${LIBS}

cookbook: cookbook.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o cookbook cookbook.o -L. -lcfitsio -lm ${LIBS}

eval: # Rebuild eval_* files from flex/bison source
$(FLEX) -t eval.l > eval_l.c1
/bin/sed -e 's/yy/ff/g' -e 's/YY/FF/g' eval_l.c1 > eval_l.c
/bin/rm -f eval_l.c1
$(BISON) -d -v -y eval.y
/bin/sed -e 's/yy/ff/g' -e 's/YY/FF/g' y.tab.c > eval_y.c
/bin/sed -e 's/yy/ff/g' -e 's/YY/FF/g' y.tab.h > eval_tab.h
/bin/rm -f y.tab.c y.tab.h

clean:
- /bin/rm -f *.o libcfitsio.a libcfitsio${SHLIB_SUFFIX} \
smem testprog y.output

distclean: clean
- /bin/rm -f Makefile config.*

# Make target which outputs the list of the .o contained in the cfitsio lib
# usefull to build a single big shared library containing Tcl/Tk and other
# extensions. used for the Tcl Plugin.

cfitsioLibObjs:
@echo ${CORE_OBJECTS}

# This target actually builds the objects needed for the lib in the above
# case
objs: ${CORE_OBJECTS}

${CFITSIO_LIB} ${CFITSIO_INCLUDE}:
@if [ ! -d $@ ]; then mkdir $@; fi
151 changes: 151 additions & 0 deletions pkg/tbtables/cfitsio/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
CFITSIO Interface Library

CFITSIO is a library of ANSI C routines for reading and writing FITS
format data files. A set of Fortran-callable wrapper routines are also
included for the convenience of Fortran programmers. This README file
gives a brief summary of how to build and test CFITSIO, but the CFITSIO
User's Guide, found in the files cfitsio.doc (plain text), cfitsio.tex
(LaTeX source file), or cfitsio.ps (postscript format), should be
referenced for the latest and most complete information.

BUILDING CFITSIO
----------------

The CFITSIO code is contained in about 40 *.c source files and several *.h
header files. The CFITSIO library is built on Unix systems by typing:

> ./configure [--prefix=/target/installation/path]
> make (or 'make shared')
> make install (this step is optional)

at the operating system prompt. The configure command customizes the
Makefile for the particular system, then the `make' command compiles the
source files and builds the library. Type `./configure' and not simply
`configure' to ensure that the configure script in the current directory
is run and not some other system-wide configure script. The optional
'prefix' argument to configure gives the path to the directory where
the CFITSIO library and include files should be installed via the later
'make install' command. For example,

> ./configure --prefix=/usr1/local

will cause the 'make install' command to copy the CFITSIO libcfitsio file
to /usr1/local/lib and the necessary include files to /usr1/local/include
(assuming of course that the process has permission to write to these
directories).

On VAX/VMS and ALPHA/VMS systems the make.com command file may be used
to build the cfitsio.olb object library using the default G-floating
point option for double variables. The make\_dfloat.com and make\_ieee.com
files may be used instead to build the library with the other floating
point options.

A precompiled DLL version of CFITSIO is available for IBM-PC users of
the Borland or Microsoft Visual C++ compilers in the files
cfitsiodll_2xxx_borland.zip and cfitsiodll_2xxx_vcc.zip, where '2xxx'
represents the current release number. These zip archives also
contains other files and instructions on how to use the CFITSIO DLL
library. The CFITSIO library may also be built from the source code
using the makefile.bc or makefile.vcc files. Finally, the makepc.bat
file gives an example of building CFITSIO with the Borland C++ v4.5
compiler using simpler DOS commands.

On OS/2 systems, CFITSIO can be built using the supplied makefile by
typing 'make -f makefile.os2'. This makefile requires the GCC compiler
and EMX library, which are available from many Internet sites
containing OS/2 software, such as
ftp-os2.nmsu.edu/pub/os2/dev/emx/v0.9c and
ftp.leo.org/pub/comp/os/os2/leo/devtools/emx+gcc.

When building on Mac OS-X, users should follow the Unix instructions,
above. Previous MacOS versions of the cfitsio library can be built by
(1) un binhex and unstuff cfitsio_mac.sit.hqx, (2) put CFitsioPPC.mcp
in the cfitsio directory, and (3) load CFitsioPPC.mcp into CodeWarrior
Pro 5 and make. This builds the cfitsio library for PPC. There are
also targets for both the test program and the speed test program.

To use the MacOS port you can add Cfitsio PPC.lib to your Codewarrior
Pro 5 project. Note that this only has been tested for the PPC and
probably won't work
on 68k macs.

TESTING CFITSIO
---------------

The CFITSIO library should be tested by building and running
the testprog.c program that is included with the release.
On Unix systems, type:
-
% make testprog
% testprog > testprog.lis
% diff testprog.lis testprog.out
% cmp testprog.fit testprog.std
-
On VMS systems,
(assuming cc is the name of the C compiler command), type:
-
$ cc testprog.c
$ link testprog, cfitsio/lib
$ run testprog
-
The testprog program should produce a FITS file called `testprog.fit'
that is identical to the testprog.std FITS file included in this
release. The diagnostic messages (which were piped to the file
testprog.lis in the Unix example) should be identical to the listing
contained in the file testprog.out. The 'diff' and 'cmp' commands
shown above should not report any differences in the files.

USING CFITSIO
-------------

The CFITSIO User's Guide, contained in the files cfitsio.doc (plain
text file) and cfitsio.ps (postscript file), provides detailed
documentation about how to build and use the CFITSIO library.
It contains a description of every user-callable routine in the
CFITSIO interface.

The cookbook.c file provides some sample routines for performing common
operations on various types of FITS files. Programmers are urged to
examine these routines for recommended programming practices when using
CFITSIO. Users are free to copy or modify these routines for their own
purposes.

SUPPORTED PLATFORMS
-------------------

CFITSIO has currently been tested on the following platforms:

Operating System Compiler
---------------- --------
OPERATING SYSTEM COMPILER
Sun OS gcc and cc (3.0.1)
Sun Solaris gcc and cc
Silicon Graphics IRIX gcc and cc
Silicon Graphics IRIX64 MIPS
Dec Alpha OSF/1 gcc and cc
DECstation Ultrix gcc
Dec Alpha OpenVMS cc
DEC VAX/VMS gcc and cc
HP-UX gcc
IBM AIX gcc
Linux gcc
MkLinux DR3
Windows 95/98/NT Borland C++ V4.5
Windows 95/98/NT/ME/XP Microsoft/Compaq Visual C++ v5.0, v6.0
Windows 95/98/NT Cygwin gcc
OS/2 gcc + EMX
Mac OS 7.1 or greater Metrowerks 10.+
Mac OS-X 10.1 or greater cc (gcc)

CFITSIO will probably run on most other Unix platforms without
modification. Cray supercomputers and IBM mainframe computers are
currently not supported.

Reports of any success or failure to run CFITSIO on other platforms
would be appreciated. Any problem reports or suggestions for
improvements are also welcome and should be sent to the primary author.

-------------------------------------------------------------------------
William D. Pence
[email protected]
HEASARC, NASA/GSFC
31 changes: 31 additions & 0 deletions pkg/tbtables/cfitsio/README.MacOS
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
To build the CFITSIO library on Mac OS-X systems, follow the
instructions for Unix platforms given in the CFITSIO User's Reference
Guide (cfitsio.doc).

To build the MacOS port on classic Mac OS-9 or earlier:

1. Un binhex and unstuff cfitsio_mac.sit.hqx
2. put CFitsioPPC.mcp in the cfitsio directory.
2. Load CFitsioPPC.mcp into CodeWarrior Pro 5 and make.
This builds the cfitsio library for PPC. There are also targets for both
the test program and the speed test program.

To use the MacOS port you can add Cfitsio PPC.lib to your Codewarrior Pro 5
project. Note that this only has been tested for the PPC. It probably
won't work on 68k macs. Also note that the fortran bindings aren't
included. I haven't worked with the codewarrior f2c plugin so I don't know
how these would work. If one is interested, please write and I can look
into this.

[email protected]

Modifications...

10/22/98: [email protected]
New files added for project. Converted to CodeWarrior Pro 3.
The speed test program does not run... complains about a missing library?
11/09/98: [email protected]
Fixed speed test problem thanks to Tom Andersen.
07/17/00: [email protected]
Updated to CodeWarrior Pro 5 and CFITSIO 2.037.

Loading

0 comments on commit 40b284f

Please sign in to comment.