Commit 51f91aa0 authored by Adam Mercer's avatar Adam Mercer 🛌

use preprocessor for FrameSeries source, not m4

Original: 74307c73d02c9711929dfd11f5ec4c1f6a58c385
parent eb3a8433
......@@ -8,7 +8,7 @@ fail () {
}
## build sources, where appropriate
for d in lal lalframe; do
for d in lal; do
echo "00boot: building sources in $d"
(cd "$d" && ./00boot --only-build-sources 1>/dev/null) || fail "00boot in $d"
done
......
......@@ -19,7 +19,6 @@ lalframe-*.tar.gz
lalframe.pc
lalframe.spec
libtool
src/FrameSeries.c
src/LALFrameConfig.h
src/LALFrameVCSInfo.h
src/lalframe-user-env.csh
......
......@@ -11,8 +11,6 @@ helpmsg="Usage $0 [options]
Options: [defaults in brackets after description]"
helpmsg="$helpmsg
--help print this message"
helpmsg="$helpmsg
--with-m4=M4 use GNU-m4 program M4 [m4]"
helpmsg="$helpmsg
--with-autoreconf=AUTORECONF use autoreconf program AUTORECONF [autoreconf]"
helpmsg="$helpmsg
......@@ -23,8 +21,6 @@ helpmsg="$helpmsg
--with-automake=AUTOMAKE use automake program AUTOMAKE [automake]"
helpmsg="$helpmsg
--with-autoconf=AUTOCONF use autoconf program AUTOCONF [autoconf]"
helpmsg="$helpmsg
--only-build-sources only build sources, not build system"
# default options
only_build_sources="false"
......@@ -38,13 +34,11 @@ while test $# -gt 0 ; do
esac
case $option in
-h | -help | --help ) echo "$helpmsg"; exit 0;;
-with-m4=* | --with-m4=* ) M4="$optarg";;
-with-autoreconf=* | --with-autoreconf=* ) AUTORECONF="$optarg";;
-with-aclocal=* | --with-aclocal=* ) ACLOCAL="$optarg";;
-with-autoheader=* | --with-autoheader=* ) AUTOHEADER="$optarg";;
-with-automake=* | --with-automake=* ) AUTOMAKE="$optarg";;
-with-autoconf=* | --with-autoconf=* ) AUTOCONF="$optarg";;
-only-build-sources | --only-build-sources ) only_build_sources="true";;
*) echo "unrecognized option $option"; exit 1;;
esac
shift
......@@ -52,7 +46,6 @@ done
# check autotools versions
echo "00boot: checking versions of autotools"
M4=${M4:-"m4"}
AUTORECONF=${AUTORECONF:-"autoreconf"}
ACLOCAL=${ACLOCAL:-"aclocal"}
AUTOHEADER=${AUTOHEADER:-"autoheader"}
......@@ -87,15 +80,6 @@ printf "00boot:\t%-16s %s\n" "autoheader-$autoheader_version:" "`which $AUTOHEAD
printf "00boot:\t%-16s %s\n" "automake-$automake_version:" "`which $AUTOMAKE`"
printf "00boot:\t%-16s %s\n" "autoconf-$autoconf_version:" "`which $AUTOCONF`"
# run m4 to generate sources
echo "00boot: creating sources"
cd src || fail "creating sources in src"
${M4} FrameSeries.m4 > FrameSeries.c || fail "creating sources in src"
cd .. || fail "creating sources in src"
# don't build the build system if --only-build-sources option is specified
if test "$only_build_sources" = "false"; then
# FIXME: autoreconf from Ubuntu 9.10 (and probably also from recent
# Debian versions) automatically run libtoolize with the --copy option
# therefore over writing the supplied libtool scripts with system
......@@ -120,5 +104,3 @@ echo "
to configure LAL Frame.
================================================================="
fi
all-local: header-links
header-links:
@for file in $(HEADERS) ; do \
@for file in $(lalframeinclude_HEADERS) ; do \
sourcedir=`cd $(srcdir) && pwd`; \
targetdir=`cd $(top_builddir)/include/lal && pwd`; \
if test ! -r $$targetdir/$$file ; then \
......
/*
* Copyright (C) 2007 Jolien Creighton, and Duncan Brown, and Xavier Siemens,
* and Kipp Cannon
*
* 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 the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program 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 program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**** <lalVerbatim file="FrameSeriesCV">
* Author: Jolien D. E. Creighton
* $Id$
......@@ -785,31 +804,65 @@ REAL8TimeSeries * XLALFrInputREAL8TimeSeries( FrStream *stream, const char *chan
return series;
}
define(`TYPE',`COMPLEX16')
include(`FrameSeriesRead.m4')
include(`FrameSeriesWrite.m4')
define(`TYPE',`COMPLEX8')
include(`FrameSeriesRead.m4')
include(`FrameSeriesWrite.m4')
define(`TYPE',`REAL8')
include(`FrameSeriesRead.m4')
include(`FrameSeriesWrite.m4')
define(`TYPE',`REAL4')
include(`FrameSeriesRead.m4')
include(`FrameSeriesWrite.m4')
define(`TYPE',`INT8')
include(`FrameSeriesRead.m4')
include(`FrameSeriesWrite.m4')
define(`TYPE',`INT4')
include(`FrameSeriesRead.m4')
include(`FrameSeriesWrite.m4')
define(`TYPE',`INT2')
include(`FrameSeriesRead.m4')
include(`FrameSeriesWrite.m4')
#define TYPE COMPLEX16
#define FRTYPE FR_VECT_16C
#define FRDATA dataD
#include "FrameSeriesRead_source.c"
#include "FrameSeriesWrite_source.c"
#undef TYPE
#undef FRTYPE
#undef FRDATA
#define TYPE COMPLEX8
#define FRTYPE FR_VECT_8C
#define FRDATA dataF
#include "FrameSeriesRead_source.c"
#include "FrameSeriesWrite_source.c"
#undef TYPE
#undef FRTYPE
#undef FRDATA
#define TYPE REAL8
#define FRTYPE FR_VECT_8R
#define FRDATA dataD
#include "FrameSeriesRead_source.c"
#include "FrameSeriesWrite_source.c"
#undef TYPE
#undef FRTYPE
#undef FRDATA
#define TYPE REAL4
#define FRTYPE FR_VECT_4R
#define FRDATA dataF
#include "FrameSeriesRead_source.c"
#include "FrameSeriesWrite_source.c"
#undef TYPE
#undef FRTYPE
#undef FRDATA
#define TYPE INT8
#define FRTYPE FR_VECT_8S
#define FRDATA dataL
#include "FrameSeriesRead_source.c"
#include "FrameSeriesWrite_source.c"
#undef TYPE
#undef FRTYPE
#undef FRDATA
#define TYPE INT4
#define FRTYPE FR_VECT_4S
#define FRDATA dataI
#include "FrameSeriesRead_source.c"
#include "FrameSeriesWrite_source.c"
#undef TYPE
#undef FRTYPE
#undef FRDATA
#define TYPE INT2
#define FRTYPE FR_VECT_2S
#define FRDATA dataS
#include "FrameSeriesRead_source.c"
#include "FrameSeriesWrite_source.c"
#undef TYPE
#undef FRTYPE
#undef FRDATA
dnl $Id$
dnl
dnl Copyright (C) 2007 Jolien Creighton, and Duncan Brown, and Xavier Siemens,
dnl and Kipp Cannon
dnl
dnl This program is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 2 of the License, or (at your
dnl option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
dnl Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program; if not, write to the Free Software Foundation, Inc.,
dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
ifelse(TYPE,`COMPLEX16',`define(`FRTYPE',`FR_VECT_16C')')
ifelse(TYPE,`COMPLEX8',`define(`FRTYPE',`FR_VECT_8C')')
ifelse(TYPE,`REAL8',`define(`FRTYPE',`FR_VECT_8R')')
ifelse(TYPE,`REAL4',`define(`FRTYPE',`FR_VECT_4R')')
ifelse(TYPE,`INT8',`define(`FRTYPE',`FR_VECT_8S')')
ifelse(TYPE,`INT4',`define(`FRTYPE',`FR_VECT_4S')')
ifelse(TYPE,`INT2',`define(`FRTYPE',`FR_VECT_2S')')
ifelse(TYPE,`COMPLEX16',`define(`FRDATA',`dataD')')
ifelse(TYPE,`COMPLEX8',`define(`FRDATA',`dataF')')
ifelse(TYPE,`REAL8',`define(`FRDATA',`dataD')')
ifelse(TYPE,`REAL4',`define(`FRDATA',`dataF')')
ifelse(TYPE,`INT8',`define(`FRDATA',`dataL')')
ifelse(TYPE,`INT4',`define(`FRDATA',`dataI')')
ifelse(TYPE,`INT2',`define(`FRDATA',`dataS')')
define(`STYPE',`format(`%sTimeSeries',TYPE)')
define(`FSTYPE',`format(`%sFrequencySeries',TYPE)')
define(`XFUNC',`format(`XLALFrGet%s',STYPE)')
define(`XFUNCM',`format(`XLALFrGet%sMetadata',STYPE)')
define(`FUNC',`format(`LALFrGet%s',STYPE)')
define(`FUNCM',`format(`LALFrGet%sMetadata',STYPE)')
define(`XFSFUNC',`format(`XLALFrGet%s',FSTYPE)')
define(`FSFUNC',`format(`LALFrGet%s',FSTYPE)')
#define CONCAT2x(a,b) a##b
#define CONCAT2(a,b) CONCAT2x(a,b)
#define CONCAT3x(a,b,c) a##b##c
#define CONCAT3(a,b,c) CONCAT3x(a,b,c)
#define STRING(a) #a
#define STYPE CONCAT2(TYPE,TimeSeries)
#define FSTYPE CONCAT2(TYPE,FrequencySeries)
#define XFUNC CONCAT2(XLALFrGet,STYPE)
#define XFUNCM CONCAT3(XLALFrGet,STYPE,Metadata)
#define FUNC CONCAT2(LALFrGet,STYPE)
#define FUNCM CONCAT3(LALFrGet,STYPE,Metadata)
#define XFSFUNC CONCAT2(XLALFrGet,FSTYPE)
#define FSFUNC CONCAT2(LALFrGet,FSTYPE)
#define XRFUNC CONCAT2(XLALFrRead,STYPE)
#define XCFUNC CONCAT2(XLALCreate,STYPE)
#define XDFUNC CONCAT2(XLALDestroy,STYPE)
#define XREFUNC CONCAT2(XLALResize,STYPE)
/* <lalVerbatim file="FrameSeriesCP"> */
int XFSFUNC ( FSTYPE *series, FrStream *stream )
{ /* </lalVerbatim> */
static const char func[] = "XFSFUNC";
static const char func[] = STRING(XFSFUNC);
struct FrVect *vect;
if ( stream->state & LAL_FR_ERR )
......@@ -100,7 +77,7 @@ FSFUNC (
)
{ /* </lalVerbatim> */
struct FrVect *vect;
INITSTATUS( status, "FSFUNC", FRAMESERIESC );
INITSTATUS( status, STRING(FSFUNC), FRAMESERIESC );
ASSERT( series, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL );
ASSERT( ! series->data, status, FRAMESTREAMH_ENNUL, FRAMESTREAMH_MSGENNUL );
......@@ -159,7 +136,7 @@ FSFUNC (
int XFUNCM ( STYPE *series, FrStream *stream )
{
static const char func[] = "XFUNCM";
static const char func[] = STRING(XFUNCM);
const REAL8 fuzz = 0.1 / 16384.0; /* smallest discernable unit of time */
struct FrVect *vect;
UINT4 noff;
......@@ -211,7 +188,7 @@ int XFUNCM ( STYPE *series, FrStream *stream )
int XFUNC ( STYPE *series, FrStream *stream )
{
static const char func[] = "XFUNC";
static const char func[] = STRING(XFUNC);
const REAL8 fuzz = 0.1 / 16384.0; /* smallest discernable unit of time */
struct FrVect *vect;
UINT4 need;
......@@ -411,7 +388,7 @@ FUNC (
REAL8 rate;
INT4 gap = 0;
INITSTATUS( status, "FUNC", FRAMESERIESC );
INITSTATUS( status, STRING(FUNC), FRAMESERIESC );
ASSERT( series, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL );
ASSERT( stream, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL );
......@@ -614,7 +591,7 @@ FUNCM (
{ /* </lalVerbatim> */
void *sequence;
INITSTATUS (status, "FUNCM", FRAMESERIESC);
INITSTATUS (status, STRING(FUNCM), FRAMESERIESC);
ATTATCHSTATUSPTR (status);
ASSERT (series, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL);
......@@ -636,7 +613,7 @@ FUNCM (
}
STYPE *`XLALFrRead'STYPE (
STYPE *XRFUNC (
FrStream *stream,
const char *chname,
const LIGOTimeGPS *start,
......@@ -644,18 +621,18 @@ STYPE *`XLALFrRead'STYPE (
size_t lengthlimit
)
{
static const char func[] = "`XLALFrRead'STYPE";
static const char func[] = STRING(XRFUNC);
STYPE *series;
size_t length;
/* create and initialize a zero-length time series vector */
series = `XLALCreate'STYPE (chname, start, 0.0, 0.0, &lalADCCountUnit, 0);
series = XCFUNC(chname, start, 0.0, 0.0, &lalADCCountUnit, 0);
if(!series)
XLAL_ERROR_NULL (func, XLAL_EFUNC);
/* get the time series meta-data */
if(`XLALFrGet'STYPE`Metadata' (series, stream)) {
`XLALDestroy'STYPE (series);
if(XFUNCM(series, stream)) {
XDFUNC(series);
XLAL_ERROR_NULL (func, XLAL_EFUNC);
}
......@@ -663,14 +640,14 @@ STYPE *`XLALFrRead'STYPE (
length = duration / series->deltaT;
if(lengthlimit && (lengthlimit < length))
length = lengthlimit;
if(!`XLALResize'STYPE (series, 0, length)) {
`XLALDestroy'STYPE (series);
if(!XREFUNC(series, 0, length)) {
XDFUNC(series);
XLAL_ERROR_NULL (func, XLAL_EFUNC);
}
/* read the data */
if(XLALFrSeek (stream, start) || `XLALFrGet'STYPE (series, stream)) {
`XLALDestroy'STYPE (series);
if(XLALFrSeek (stream, start) || XFUNC(series, stream)) {
XDFUNC(series);
XLAL_ERROR_NULL (func, XLAL_EFUNC);
}
......
ifelse(TYPE,`COMPLEX16',`define(`FRTYPE',`FR_VECT_16C')')
ifelse(TYPE,`COMPLEX8',`define(`FRTYPE',`FR_VECT_8C')')
ifelse(TYPE,`REAL8',`define(`FRTYPE',`FR_VECT_8R')')
ifelse(TYPE,`REAL4',`define(`FRTYPE',`FR_VECT_4R')')
ifelse(TYPE,`INT8',`define(`FRTYPE',`FR_VECT_8S')')
ifelse(TYPE,`INT4',`define(`FRTYPE',`FR_VECT_4S')')
ifelse(TYPE,`INT2',`define(`FRTYPE',`FR_VECT_2S')')
ifelse(TYPE,`COMPLEX16',`define(`FRDATA',`dataD')')
ifelse(TYPE,`COMPLEX8',`define(`FRDATA',`dataD')')
ifelse(TYPE,`REAL8',`define(`FRDATA',`dataD')')
ifelse(TYPE,`REAL4',`define(`FRDATA',`dataF')')
ifelse(TYPE,`INT8',`define(`FRDATA',`dataL')')
ifelse(TYPE,`INT4',`define(`FRDATA',`dataI')')
ifelse(TYPE,`INT2',`define(`FRDATA',`dataS')')
define(`STYPE',`format(`%sTimeSeries',TYPE)')
define(`FSTYPE',`format(`%sFrequencySeries',TYPE)')
define(`FUNC',`format(`LALFrWrite%s',STYPE)')
define(`FSFUNC',`format(`LALFrWrite%s',FSTYPE)')
define(`XFUNC',`format(`XLALFrWrite%s',STYPE)')
define(`XFSFUNC',`format(`XLALFrWrite%s',FSTYPE)')
int XFUNC ( STYPE *series, int frnum )
#define CONCAT2x(a,b) a##b
#define CONCAT2(a,b) CONCAT2x(a,b)
#define CONCAT3x(a,b,c) a##b##c
#define CONCAT3(a,b,c) CONCAT3x(a,b,c)
#define STRING(a) #a
#define STYPE CONCAT2(TYPE,TimeSeries)
#define FSTYPE CONCAT2(TYPE,FrequencySeries)
#define WFUNC CONCAT2(LALFrWrite,STYPE)
#define FSWFUNC CONCAT2(LALFrWrite,FSTYPE)
#define XWFUNC CONCAT2(XLALFrWrite,STYPE)
#define XFSWFUNC CONCAT2(XLALFrWrite,FSTYPE)
int XWFUNC ( STYPE *series, int frnum )
{
static const char func[] = "XFUNC";
static const char func[] = STRING(XWFUNC);
char fname[FILENAME_MAX];
char tmpfname[FILENAME_MAX];
char comment[] = "XFUNC $Id$";
char comment[] = STRING(XWFUNC);
char seconds[] = "s";
char units[LALUnitTextSize];
const int run = 0; /* this routine always sets run number to zero */
......@@ -160,7 +151,7 @@ int XFUNC ( STYPE *series, int frnum )
/* <lalVerbatim file="FrameSeriesCP"> */
void
FUNC (
WFUNC (
LALStatus *status,
STYPE *series,
FrOutPar *params
......@@ -168,7 +159,7 @@ FUNC (
{ /* </lalVerbatim> */
TYPE *data;
CHAR seconds[] = "s";
CHAR comment[] = "Created by FUNC $Id$";
CHAR comment[] = "Created by " STRING(WFUNC);
CHAR source[FILENAME_MAX];
CHAR fname[FILENAME_MAX];
CHAR tmpfname[FILENAME_MAX];
......@@ -180,7 +171,7 @@ FUNC (
INT8 tend;
INT4 dt;
INITSTATUS( status, "FUNC", FRAMESERIESC );
INITSTATUS( status, STRING(WFUNC), FRAMESERIESC );
ASSERT( series, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL );
ASSERT( params, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL );
ATTATCHSTATUSPTR( status );
......@@ -267,7 +258,7 @@ FUNC (
/* <lalVerbatim file="FrameSeriesCP"> */
void
FSFUNC (
FSWFUNC (
LALStatus *status,
FSTYPE *series,
FrOutPar *params,
......@@ -276,7 +267,7 @@ FSFUNC (
{ /* </lalVerbatim> */
TYPE *data;
CHAR hertz[] = "Hz";
CHAR comment[] = "Created by FSFUNC $Id$";
CHAR comment[] = "Created by " STRING(FSWFUNC);
CHAR source[FILENAME_MAX];
CHAR fname[FILENAME_MAX];
CHAR tmpfname[FILENAME_MAX];
......@@ -289,7 +280,7 @@ FSFUNC (
INT8 tend;
INT4 dt;
INITSTATUS( status, "FUNC", FRAMESERIESC );
INITSTATUS( status, STRING(FSWFUNC), FRAMESERIESC );
ASSERT( series, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL );
ASSERT( params, status, FRAMESTREAMH_ENULL, FRAMESTREAMH_MSGENULL );
ATTATCHSTATUSPTR( status );
......
......@@ -23,6 +23,10 @@ liblalframe_la_SOURCES = \
LALFrameIO.c \
LALFrameVCSInfo.c
noinst_HEADERS = \
FrameSeriesRead_source.c \
FrameSeriesWrite_source.c
liblalframe_la_LDFLAGS = -version-info $(LIBVERSION)
CLEANFILES = \
......@@ -79,17 +83,9 @@ lalframe-user-env.csh: Makefile
EXTRA_DIST = \
generate_vcs_info.py \
FrameSeries.m4 \
FrameSeriesRead.m4 \
FrameSeriesWrite.m4 \
LALFrameConfig.h.in \
LALFrameVCSInfo.h.in
MAINTAINERCLEANFILES = FrameSeries.c
FrameSeries.c: FrameSeries.m4 FrameSeriesRead.m4 FrameSeriesWrite.m4
cd $(srcdir) && m4 FrameSeries.m4 > FrameSeries.c
LALFrameVCSInfo.h: ._vcsinfo
._vcsinfo: $(srcdir)/generate_vcs_info.py LALFrameConfig.h
......
Markdown is supported
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