Mercurial > hg > octave-nkf
view src/mkbuiltins @ 4822:d0aa1a59b73b ss-2-1-56
[project @ 2004-03-05 19:15:30 by jwe]
author | jwe |
---|---|
date | Fri, 05 Mar 2004 19:15:30 +0000 |
parents | 02fcb550f20c |
children | 4c8a2e4e0717 |
line wrap: on
line source
#!/bin/sh if test $# -ne 2; then echo "usage: mkbuiltins f1 f2" 1>&2 exit 1 fi SED=${SED:-'sed'} 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 "defun.h" #include "oct-obj.h" #include "variables.h" #if defined (quad) #undef quad #endif #if defined (ENABLE_DYNAMIC_LINKING) #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) #else #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) #endif #define XDEFUN_INTERNAL(name, args_name, nargout_name, is_text_fcn, doc) \ extern DECLARE_FUN (name, args_name, nargout_name); \ install_builtin_function (F ## name, #name, doc, is_text_fcn); \ #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, \ is_text_fcn, doc) \ extern DECLARE_FUN (name, args_name, nargout_name); \ install_builtin_function (F ## name, #name, doc, is_text_fcn, false); \ #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, \ is_text_fcn, doc) \ extern DECLARE_FUNX (fname, args_name, nargout_name); \ install_builtin_function (fname, name, doc, is_text_fcn); \ #define XDEFALIAS_INTERNAL(alias, name) \ alias_builtin (#alias, #name); #define XDEFVAR_INTERNAL(name, sname, defn, protect, chg_fcn, doc) #define XDEFCONST_INTERNAL(name, defn, doc) #define XDEFUN_MAPPER_INTERNAL(name, ch_map, d_b_map, c_b_map, d_d_map, \ d_c_map, c_c_map, lo, hi, \ ch_map_flag, can_ret_cmplx_for_real, doc) EOF for file in $DEF_FILES; do fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` echo "static void" echo "install_${fcn}_fcns (void)" echo "{" cat $file echo "}" echo "" done for file in $VAR_FILES; do f=`echo $file | $SED 's,^\./,,; s/-/_/g'` echo "extern void symbols_of_${f} (void);" done cat << \EOF static void install_builtin_variables (void) { EOF for file in $VAR_FILES; do f=`echo $file | $SED 's,^\./,,; s/-/_/g'` echo " symbols_of_${f} ();" done cat << \EOF } static void install_builtin_functions (void) { EOF for file in $DEF_FILES; do fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` echo " install_${fcn}_fcns ();" done cat << \EOF } extern void install_mapper_functions (void); void install_builtins (void) { install_builtin_variables (); install_mapper_functions (); install_builtin_functions (); } EOF exit 0