Mercurial > hg > octave-nkf
annotate src/mkbuiltins @ 15004:ea6997657614
which: provide source file name for built-in functions
* defun-int.h, defun.cc (install_builtin_function): New arg, FILE.
Pass file to octave_builtin constructor.
* mkbuiltins: Redefine XDEFUN_FILE_NAME to create a local FILE
variable. Pass FILE to install_builtin_function.
* ov-builtin.h (octave_builtin::file): New member variable.
(octave_builtin::octave_builtin): Handle file name.
(octave_builtin::fcn_file_name): New function.
* ov-fcn-handle.cc (octave_fcn_handle::set_fcn): Only attempt to load
functions from .oct, .mex, or .m files.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 23 Jul 2012 12:59:44 -0400 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
6218 | 1 #! /bin/sh |
7019 | 2 # |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
3 # Copyright (C) 1996-2012 John W. Eaton |
7019 | 4 # |
5 # This file is part of Octave. | |
6 # | |
7 # Octave is free software; you can redistribute it and/or modify it | |
8 # under the terms of the GNU General Public License as published by the | |
9 # Free Software Foundation; either version 3 of the License, or (at | |
10 # your option) any later version. | |
11 # | |
12 # Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 # for more details. | |
16 # | |
17 # You should have received a copy of the GNU General Public License | |
18 # along with Octave; see the file COPYING. If not, see | |
19 # <http://www.gnu.org/licenses/>. | |
2335 | 20 |
9906 | 21 if test $# -eq 0; then |
22 echo "usage: mkbuiltins f1 f2 ..." 1>&2 | |
2907 | 23 exit 1 |
24 fi | |
25 | |
4299 | 26 SED=${SED:-'sed'} |
27 | |
2335 | 28 cat << \EOF |
29 // DO NOT EDIT! Generated automatically by mkbuiltins. | |
30 | |
31 #ifdef HAVE_CONFIG_H | |
32 #include "config.h" | |
33 #endif | |
34 | |
2968 | 35 #include "defun.h" |
2335 | 36 #include "oct-obj.h" |
37 #include "variables.h" | |
7210 | 38 #include "builtins.h" |
2335 | 39 |
3399 | 40 #if defined (quad) |
41 #undef quad | |
42 #endif | |
43 | |
4128 | 44 #if defined (ENABLE_DYNAMIC_LINKING) |
5796 | 45 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
46 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 47 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
48 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 49 |
3364 | 50 #else |
5796 | 51 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
52 #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
|
53 XDEFUN_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 54 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
55 #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
|
56 XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 57 |
3364 | 58 #endif |
59 | |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
60 #define XDEFUN_FILE_NAME(name) \ |
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
61 std::string file = name; |
9014
71fca0fc2436
save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
62 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
63 #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
3295 | 64 extern DECLARE_FUN (name, args_name, nargout_name); \ |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
65 install_builtin_function (F ## name, #name, file, doc); \ |
4234 | 66 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
67 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
4234 | 68 extern DECLARE_FUN (name, args_name, nargout_name); \ |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
69 install_builtin_function (F ## name, #name, file, doc, false); \ |
3295 | 70 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
71 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) \ |
3744 | 72 extern DECLARE_FUNX (fname, args_name, nargout_name); \ |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
73 install_builtin_function (fname, name, file, doc); \ |
3744 | 74 |
3295 | 75 #define XDEFALIAS_INTERNAL(alias, name) \ |
76 alias_builtin (#alias, #name); | |
77 | |
3321 | 78 #define XDEFCONST_INTERNAL(name, defn, doc) |
3295 | 79 |
2373 | 80 EOF |
81 | |
9906 | 82 for arg |
83 do | |
84 fcn=`echo "$arg" | $SED 's,.*/,,; s/\.df//; s/-/_/g;'` | |
2373 | 85 echo "static void" |
86 echo "install_${fcn}_fcns (void)" | |
87 echo "{" | |
9906 | 88 cat "$arg" |
2373 | 89 echo "}" |
2907 | 90 echo "" |
91 done | |
92 | |
2373 | 93 cat << \EOF |
2907 | 94 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
95 void |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
96 install_builtins (void) |
2335 | 97 { |
98 EOF | |
99 | |
9906 | 100 for arg |
101 do | |
102 fcn=`echo "$arg" | $SED 's,.*/,,; s/\.df//; s/-/_/g;'` | |
2373 | 103 echo " install_${fcn}_fcns ();" |
104 done | |
2335 | 105 |
106 cat << \EOF | |
107 } | |
108 | |
109 EOF | |
110 | |
111 exit 0 |