#!/bin/sh

cat << \EOF
// DO NOT EDIT!  Generated automatically by mkbuiltins.

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "builtins.h"
#include "mappers.h"
#include "oct-obj.h"
#include "variables.h"

EOF

for file in "$@"; do
  fcn=`echo $file | sed -e 's/\.df//' -e 's/-/_/g'`
  echo "static void"
  echo "install_${fcn}_fcns (void)"
  echo "{"
  cat $file
  echo "}"
done

cat << \EOF
static void
install_builtin_functions (void)
{
EOF

for file in "$@"; do
  fcn=`echo $file | sed -e 's/\.df//' -e 's/-/_/g'`
  echo "  install_${fcn}_fcns ();"
done

cat << \EOF
}

void
install_builtins (void)
{
  install_builtin_variables ();
  install_mapper_functions ();
  install_builtin_functions ();
}
EOF

exit 0
