The R Project SVN R

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#!/bin/sh

# This code assembles the table of statically loaded C and Fortran
# code which is to be accessed via .C and .Fortran calls.

ROUTINES="appl/ROUTINES"

sed '
s/F77_SUBROUTINE(\(.*\))/int \1_();/
s/C_FUNCTION(\(.*\))/int \1();/
' ${ROUTINES} > /tmp/ForeignDecl.h

if test ! -f include/ForeignDecl.h
then
    cp /tmp/ForeignDecl.h include/ForeignDecl.h
else
    if diff /tmp/ForeignDecl.h include/ForeignDecl.h
    then
    :
    else
        cp /tmp/ForeignDecl.h include/ForeignDecl.h
    fi
fi


sed '
s/F77_SUBROUTINE(\(.*\))/   { "\1_",    \1_},/
s/C_FUNCTION(\(.*\))/   { "\1", \1 },/
' ${ROUTINES} > /tmp/ForeignTab.h

if test ! -f include/ForeignTab.h
then
    cp /tmp/ForeignTab.h include/ForeignTab.h
else
    if diff /tmp/ForeignTab.h include/ForeignTab.h
    then
    :
    else
        cp /tmp/ForeignTab.h include/ForeignTab.h
    fi
fi
rm -f /tmp/ForeignTab.h /tmp/ForeignDecl.h