home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / octave-2.1.23 / src / mkbuiltins < prev    next >
Text File  |  2000-01-15  |  2KB  |  111 lines

  1. #!/bin/sh
  2.  
  3. if test $# -ne 2; then
  4.   echo "usage: mkbuiltins f1 f2" 1>&2
  5.   exit 1
  6. fi
  7.  
  8. DEF_FILES=`cat $1`
  9. VAR_FILES=`cat $2`
  10.  
  11. if test -z "$DEF_FILES"; then
  12.   echo "mkbuiltins: DEF_FILES is empty!" 1>&2
  13.   exit 1
  14. fi
  15.  
  16. if test -z "$VAR_FILES"; then
  17.   echo "mkbuiltins: VAR_FILES is empty!" 1>&2
  18.   exit 1
  19. fi
  20.  
  21. cat << \EOF
  22. // DO NOT EDIT!  Generated automatically by mkbuiltins.
  23.  
  24. #ifdef HAVE_CONFIG_H
  25. #include "config.h"
  26. #endif
  27.  
  28. #include "defun.h"
  29. #include "oct-obj.h"
  30. #include "variables.h"
  31.  
  32. #if defined (OCTAVE_LITE) && defined (WITH_DYNAMIC_LINKING)
  33. #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc)
  34. #else
  35. #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \
  36.   XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc)
  37. #endif
  38.  
  39. #define XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \
  40.   extern DECLARE_FUN (name, args_name, nargout_name); \
  41.     install_builtin_function (F ## name, #name, doc, is_text_fcn); \
  42.  
  43. #define XDEFALIAS_INTERNAL(alias, name) \
  44.   alias_builtin (#alias, #name);
  45.  
  46. #define XDEFVAR_INTERNAL(name, sname, defn, protect, chg_fcn, doc)
  47.  
  48. #define XDEFCONST_INTERNAL(name, defn, doc)
  49.  
  50. #define XDEFUN_MAPPER_INTERNAL(name, ch_map, d_b_map, c_b_map, d_d_map, \
  51.                    d_c_map, c_c_map, lo, hi, \
  52.                    can_ret_cmplx_for_real, doc)
  53.  
  54. EOF
  55.  
  56. for file in $DEF_FILES; do
  57.   fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
  58.   echo "static void"
  59.   echo "install_${fcn##*/}_fcns (void)"
  60.   echo "{"
  61.   cat $file
  62.   echo "}"
  63.   echo ""
  64. done
  65.  
  66. for file in $VAR_FILES; do
  67.   f=`echo $file | sed 's,^\./,,; s/-/_/g'`
  68.   echo "extern void symbols_of_${f##*/} (void);"
  69. done
  70.  
  71. cat << \EOF
  72.  
  73. static void
  74. install_builtin_variables (void)
  75. {
  76. EOF
  77.  
  78. for file in $VAR_FILES; do
  79.   f=`echo $file | sed 's,^\./,,; s/-/_/g'`
  80.   echo "  symbols_of_${f##*/} ();"
  81. done
  82.  
  83. cat << \EOF
  84. }
  85.  
  86. static void
  87. install_builtin_functions (void)
  88. {
  89. EOF
  90.  
  91. for file in $DEF_FILES; do
  92.   fcn=`echo $file | sed 's,^\./,,; s/\.df//; s/-/_/g'`
  93.   echo "  install_${fcn##*/}_fcns ();"
  94. done
  95.  
  96. cat << \EOF
  97. }
  98.  
  99. extern void install_mapper_functions (void);
  100.  
  101. void
  102. install_builtins (void)
  103. {
  104.   install_builtin_variables ();
  105.   install_mapper_functions ();
  106.   install_builtin_functions ();
  107. }
  108. EOF
  109.  
  110. exit 0
  111.