view src/mkbuiltins @ 2907:8bb31a2b480b

[project @ 1997-04-30 05:01:46 by jwe]
author jwe
date Wed, 30 Apr 1997 05:06:03 +0000
parents 42901f9a9266
children 057273789b87
line wrap: on
line source

#!/bin/sh

if test $# -ne 2; then
  echo "usage: mkbuiltins f1 f2" 1>&2
  exit 1
fi

DEF_FILES=`cat $1`
VAR_FILES=`cat $2`

if test -z "$DEF_FILES"; then
  echo "mkbuiltins: DEF_FILES is empty!" 1>&2
  exit 1
fi

if test -z "$VAR_FILES"; then
  echo "mkbuiltins: VAR_FILES is empty!" 1>&2
  exit 1
fi

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-builtin.h"
#include "oct-obj.h"
#include "variables.h"

EOF

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

for file in $VAR_FILES; do
  file=`echo $file | sed 's/-/_/g'`
  echo "extern void symbols_of_${file} (void);"
done

cat << \EOF

static void
install_builtin_variables (void)
{
EOF

for file in $VAR_FILES; do
  file=`echo $file | sed 's/-/_/g'`
  echo "  symbols_of_${file} ();"
done

cat << \EOF
}

static void
install_builtin_functions (void)
{
EOF

for file in $DEF_FILES; do
  fcn=`echo $file | sed 's/\.df//; 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