Mercurial > octave
annotate src/mkbuiltins @ 8746:5dd06f19e9be
handle commands in the lexer
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 15 Feb 2009 23:49:15 -0500 |
parents | 8c32f95c2639 |
children | eb63fbe60fab |
rev | line source |
---|---|
6218 | 1 #! /bin/sh |
7019 | 2 # |
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2005, | |
4 # 2006, 2007 John W. Eaton | |
5 # | |
6 # This file is part of Octave. | |
7 # | |
8 # Octave is free software; you can redistribute it and/or modify it | |
9 # under the terms of the GNU General Public License as published by the | |
10 # Free Software Foundation; either version 3 of the License, or (at | |
11 # your option) any later version. | |
12 # | |
13 # Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 # for more details. | |
17 # | |
18 # You should have received a copy of the GNU General Public License | |
19 # along with Octave; see the file COPYING. If not, see | |
20 # <http://www.gnu.org/licenses/>. | |
2335 | 21 |
5794 | 22 if test $# -ne 1; then |
23 echo "usage: mkbuiltins f1" 1>&2 | |
2907 | 24 exit 1 |
25 fi | |
26 | |
4299 | 27 SED=${SED:-'sed'} |
28 | |
2907 | 29 DEF_FILES=`cat $1` |
30 | |
31 if test -z "$DEF_FILES"; then | |
32 echo "mkbuiltins: DEF_FILES is empty!" 1>&2 | |
33 exit 1 | |
34 fi | |
35 | |
2335 | 36 cat << \EOF |
37 // DO NOT EDIT! Generated automatically by mkbuiltins. | |
38 | |
39 #ifdef HAVE_CONFIG_H | |
40 #include "config.h" | |
41 #endif | |
42 | |
2968 | 43 #include "defun.h" |
2335 | 44 #include "oct-obj.h" |
45 #include "variables.h" | |
7210 | 46 #include "builtins.h" |
2335 | 47 |
3399 | 48 #if defined (quad) |
49 #undef quad | |
50 #endif | |
51 | |
4128 | 52 #if defined (ENABLE_DYNAMIC_LINKING) |
5796 | 53 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
54 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 55 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
56 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 57 |
3364 | 58 #else |
5796 | 59 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
60 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) \ |
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
61 XDEFUN_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 62 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
63 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) \ |
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
64 XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 65 |
3364 | 66 #endif |
67 | |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
68 #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
3295 | 69 extern DECLARE_FUN (name, args_name, nargout_name); \ |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
70 install_builtin_function (F ## name, #name, doc); \ |
4234 | 71 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
72 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
4234 | 73 extern DECLARE_FUN (name, args_name, nargout_name); \ |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
74 install_builtin_function (F ## name, #name, doc, false); \ |
3295 | 75 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
76 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) \ |
3744 | 77 extern DECLARE_FUNX (fname, args_name, nargout_name); \ |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
78 install_builtin_function (fname, name, doc); \ |
3744 | 79 |
3295 | 80 #define XDEFALIAS_INTERNAL(alias, name) \ |
81 alias_builtin (#alias, #name); | |
82 | |
3321 | 83 #define XDEFCONST_INTERNAL(name, defn, doc) |
3295 | 84 |
2373 | 85 EOF |
86 | |
2907 | 87 for file in $DEF_FILES; do |
4299 | 88 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373 | 89 echo "static void" |
90 echo "install_${fcn}_fcns (void)" | |
91 echo "{" | |
92 cat $file | |
93 echo "}" | |
2907 | 94 echo "" |
95 done | |
96 | |
2373 | 97 cat << \EOF |
2907 | 98 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
99 void |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
100 install_builtins (void) |
2335 | 101 { |
102 EOF | |
103 | |
2907 | 104 for file in $DEF_FILES; do |
4299 | 105 fcn=`echo $file | $SED 's,^\./,,; s/\.df//; s/-/_/g'` |
2373 | 106 echo " install_${fcn}_fcns ();" |
107 done | |
2335 | 108 |
109 cat << \EOF | |
110 } | |
111 | |
112 EOF | |
113 | |
114 exit 0 |