Skip to content

Commit f19bbfb

Browse files
committed
pal: Begin de-slalib-ification of Starlink C code
The PAL library is a new library designed to replace Fortran SLA by providing a compatible C interface but written from scratch in C. Some routines are rewrites of the Fortran code whereas others are wrappers around SOFA routines. This is the first commit and only a handful of routines have been implemented. The PAL name comes from "Positional Astronomy Library" as used in the AST internals and in the Starlink Java PAL module. We are deliberately not using the SLA name.
0 parents  commit f19bbfb

16 files changed

+1894
-0
lines changed

Makefile.am

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Process this file with automake to produce Makefile.in
2+
3+
lib_LTLIBRARIES = libpal.la
4+
5+
libpal_la_SOURCES = $(PUBLIC_C_FILES)
6+
7+
# Force a link against SOFA
8+
libpal_la_LIBADD = $(libdir)/libsofa_c.la
9+
10+
# Make all library code position independent. This is handy for creating
11+
# shareable libraries from the static ones (Java JNI libraries).
12+
if !NOPIC
13+
libpal_la_CFLAGS = $(AM_CFLAGS) -prefer-pic
14+
endif
15+
16+
# install pal as "star/pal.h"
17+
cincludedir = $(includedir)/star
18+
cinclude_HEADERS = pal.h palmac.h
19+
20+
PUBLIC_C_FILES = \
21+
palDe2h.c \
22+
palDh2e.c \
23+
palDs2tp.c \
24+
palDat.c \
25+
palDtp2s.c \
26+
palDtps2c.c \
27+
palDtt.c
28+
29+
TESTS = palTest
30+
31+
check_PROGRAMS = palTest
32+
palTest_SOURCES = palTest.c
33+
palTest_LDADD = libpal.la

bootstrap

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#! /bin/sh -
2+
# original bootstrap file, installed by starconf 1.3, rnum=1003000
3+
# If you _need_ to change this file, delete `original' in the line above,
4+
# or else starconf may overwrite it with an updated version.
5+
#
6+
# bootstrap.installed. Generated from bootstrap.installed.in by configure.
7+
#
8+
# Bootstrap a checked-out component of the Starlink software tree.
9+
# Run this script in a freshly checked-out directory to bring the
10+
# system to the point where you can just type ./configure;make
11+
#
12+
# Usage:
13+
# ./bootstrap
14+
15+
16+
# This script should be installed, by starconf, in all `component
17+
# directories'. A `component directory' is a directory which has a
18+
# component.xml.in file in it. All component directories will have a
19+
# manifest file created and installed in .../manifests; non-component
20+
# directories will not have manifest files. Everything that's
21+
# installed should be installed as part of some component
22+
# or other.
23+
#
24+
# The ./bootstrap scripts will stop recursing when they find a
25+
# component.xml.in file. They'll warn if they find a component.xml.in
26+
# file in any AC_CONFIG_SUBDIRS directory, but ignore it, and exit
27+
# with an error if they do not find a component.xml.in file and there
28+
# are no AC_CONFIG_SUBDIRS directories in which to search further.
29+
# That is, the tree of directories which the top-level bootstrap
30+
# traverses should have component.xml.in files at or above all its
31+
# leaves.
32+
33+
34+
# The starconf below might update bootstrap, if a newer version is
35+
# available. Unfortunately, this confuses sh, which appears _not_ to
36+
# keep open the script it's reading, but to reopen it afresh, or reseek
37+
# within the file, for each line (or something like that!?).
38+
# So rewrite this script to a temporary file and exec it.
39+
tempfile="${TMP-/tmp}/$0-$$.tmp"
40+
rm -f $tempfile
41+
echo "trap 'rm -f $tempfile' 0" >$tempfile # remove temporary at exit
42+
sed '1,/^--TRAMPOLINE--/d' $0 >>$tempfile # strip out the trampoline
43+
exec /bin/sh $tempfile # exec the temporary
44+
--TRAMPOLINE--
45+
46+
47+
echo "Bootstrapping `pwd` ..."
48+
49+
if test ! -f configure.ac; then
50+
echo "bootstrap: No configure.ac in directory `pwd`" >&2
51+
exit 1
52+
fi
53+
54+
subdirs=`autoconf --trace=AC_CONFIG_SUBDIRS:$% configure.ac`
55+
56+
if test -f component.xml.in; then
57+
58+
if starconf --show buildsupport >/dev/null 2>&1; then
59+
60+
# starconf is in the path
61+
echo "...using starconf in " `starconf --show buildsupport`
62+
starconf || exit 1
63+
64+
else
65+
66+
# The temptation here is to use ./starconf.status to find the
67+
# starconf that it came from and invoke that explicitly. Don't do
68+
# this, however: we don't want to be too clever, and it's better
69+
# to be consistent with the way the autotools behave (the first
70+
# one in your path is the one that works, and they don't have this
71+
# sort of `phone home' cleverness in them).
72+
73+
echo "bootstrap error: The starconf application is not in your path"
74+
75+
# This doesn't stop us being helpful, however.
76+
if test -f ./starconf.status; then
77+
starconf_home=`./starconf.status --show buildsupport`
78+
echo "This directory was last bootstrapped with $starconf_home/bin/starconf"
79+
fi
80+
81+
exit 1
82+
fi
83+
84+
# Check that there are no component.xml.in files in any subdirectories
85+
if test -n "$subdirs"; then
86+
for d in $subdirs
87+
do
88+
if test -d "$d" && test -f "$d/component.xml.in"; then
89+
echo "bootstrap: warning: ignoring child $d/component.xml.in" >&2
90+
fi
91+
done
92+
fi
93+
94+
# If STAR_SUPPRESS_AUTORECONF is true in the environment, then we
95+
# suppress the call of `autoreconf'. This is here _only_ so that
96+
# the top-level bootstrap file can suppress multiple calls of this
97+
# in bootstrap scripts in its children. This mechanism must not
98+
# be used by users, as it is likely to change without warning.
99+
if ${STAR_SUPPRESS_AUTORECONF-false}; then
100+
echo "Suppressing autoreconf in" `pwd`
101+
else
102+
echo autoreconf --install --symlink
103+
autoreconf --install --symlink || exit 1
104+
fi
105+
106+
else
107+
108+
# This is not a component directory, so simply recurse into the children.
109+
110+
# ...if there are any, that is.
111+
if test -z "$subdirs"; then
112+
echo "bootstrap: error: non-component directory `pwd` has no subdirs" >&2
113+
exit 1
114+
fi
115+
116+
# Bootstrap the child directories mentioned in AC_CONFIG_SUBDIRS.
117+
# These bootstrap files must exist.
118+
for d in $subdirs
119+
do
120+
if test -d "$d"; then
121+
echo "Bootstrapping $d..."
122+
if test -f $d/bootstrap; then
123+
# good...
124+
(cd $d; /bin/sh ./bootstrap)
125+
else
126+
echo "bootstrap: no file $d/bootstrap" >&2
127+
exit 1
128+
fi
129+
fi
130+
done
131+
132+
fi
133+
134+
exit 0

component.xml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE component SYSTEM "componentinfo.dtd">
3+
<!-- component.xml. Generated from component.xml.in by configure. -->
4+
5+
<component id="pal" support="S">
6+
<version>0.1.0</version>
7+
<path>libraries/pal</path>
8+
<description>Position Astronomy Library</description>
9+
<abstract><p>
10+
This library is a collection of code designed to aid in
11+
replacing the SLA library with code from NOVAS and
12+
SOFA.
13+
14+
Where possible the API is similar to the C SLA API
15+
except for the use of a "pal" prefix.
16+
</p></abstract>
17+
<dependencies >
18+
<build>sofa</build><link>sofa</link>
19+
</dependencies>
20+
<developers>
21+
<person>
22+
<name>Tim Jenness</name>
23+
<uname>[email protected]</uname>
24+
</person>
25+
</developers>
26+
<documentation></documentation>
27+
<bugreports>[email protected]</bugreports>
28+
<!-- <notes><p></p></notes> -->
29+
</component>

component.xml.in

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE component SYSTEM "componentinfo.dtd">
3+
<!-- @configure_input@ -->
4+
5+
<component id="@PACKAGE@" support="S">
6+
<version>@PACKAGE_VERSION@</version>
7+
<path>libraries/pal</path>
8+
<description>Position Astronomy Library</description>
9+
<abstract><p>
10+
This library is a collection of code designed to aid in
11+
replacing the SLA library with code from NOVAS and
12+
SOFA.
13+
14+
Where possible the API is similar to the C SLA API
15+
except for the use of a "pal" prefix.
16+
</p></abstract>
17+
<dependencies @STAR_DEPENDENCIES_ATTRIBUTES@>
18+
@STAR_DEPENDENCIES_CHILDREN@
19+
</dependencies>
20+
<developers>
21+
<person>
22+
<name>Tim Jenness</name>
23+
<uname>[email protected]</uname>
24+
</person>
25+
</developers>
26+
<documentation>@STAR_DOCUMENTATION@</documentation>
27+
<bugreports>@PACKAGE_BUGREPORT@</bugreports>
28+
<!-- <notes><p></p></notes> -->
29+
</component>

configure.ac

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
dnl Process this file with autoconf to produce a configure script
2+
AC_REVISION($Revision: 27534 $)
3+
4+
dnl Initialisation: package name and version number
5+
AC_INIT(pal, 0.1.0, [email protected])
6+
7+
dnl Require autoconf-2.50 at least
8+
AC_PREREQ(2.50)
9+
dnl Require Starlink automake
10+
AM_INIT_AUTOMAKE(1.8.2-starlink)
11+
12+
dnl Sanity-check: name a file in the source directory -- if this
13+
dnl isn't found then configure will complain
14+
AC_CONFIG_SRCDIR([pal.h])
15+
16+
dnl Include defaults for Starlink configurations
17+
STAR_DEFAULTS
18+
19+
dnl Find required versions of the programs we need for configuration
20+
AC_PROG_CC
21+
AC_PROG_LIBTOOL
22+
23+
# If --with-pic=no is set we should honour that.
24+
AM_CONDITIONAL(NOPIC, test x$pic_mode = xno)
25+
26+
27+
dnl Declare the build and use dependencies for this package
28+
STAR_DECLARE_DEPENDENCIES(build, [sofa])
29+
STAR_DECLARE_DEPENDENCIES(link, [sofa])
30+
31+
dnl List the sun/ssn/... numbers which document this package and
32+
dnl which are present as .tex files in this directory.
33+
# STAR_LATEX_DOCUMENTATION(sunXXX)
34+
35+
dnl If you wish to configure extra files, you can add them to this
36+
dnl declaration.
37+
AC_CONFIG_FILES(Makefile component.xml)
38+
AC_CONFIG_HEADERS( config.h )
39+
40+
dnl This is the bit that does the actual work
41+
AC_OUTPUT

0 commit comments

Comments
 (0)