Mercurial > octave
annotate libinterp/mkbuiltins @ 21277:1bca6c72d2b1
maint: Use consistent coding style for build helper shell scripts
* mk-octave-config-h.sh: Keep if-then on a single line.
* move-if-change: Insert a space in interpreter directive for consistency.
* build-env-features.sh, config-images.sh, config-module.sh, config-ops.sh,
find-defun-files.sh, find-files-with-tests.sh, mk-errno-list,
libinterp/mk-pkg-add, scripts/mk-pkg-add, mkbuiltins, mkdefs, mkdocs,
mkf77def.in, mkops: Initialize environment variable defaults consistently.
Use shift only when the argument list is not empty. Remove unnecessary
quotes and semicolons on variable assignments. Insert/remove blank lines for
consistency.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Tue, 16 Feb 2016 18:36:00 -0800 |
parents | 1473547f50f5 |
children | 40de9f8f23a6 |
rev | line source |
---|---|
6218 | 1 #! /bin/sh |
7019 | 2 # |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19593
diff
changeset
|
3 # Copyright (C) 1996-2015 John W. Eaton |
7019 | 4 # |
5 # This file is part of Octave. | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
6 # |
7019 | 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. | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
11 # |
7019 | 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. | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
16 # |
7019 | 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 |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
21 if test $# -lt 2; then |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
22 echo "usage: mkbuiltins --header|--source f1 f2 ..." 1>&2 |
2907 | 23 exit 1 |
24 fi | |
25 | |
21277
1bca6c72d2b1
maint: Use consistent coding style for build helper shell scripts
Mike Miller <mtmiller@octave.org>
parents:
21244
diff
changeset
|
26 SED=${SED:-sed} |
4299 | 27 |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
28 make_header=false |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
29 make_source=false |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
30 case "$1" in |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
31 --header) |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
32 make_header=true |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
33 shift |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
34 ;; |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
35 --source) |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
36 make_source=true |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
37 shift |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
38 ;; |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
39 *) |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
40 echo "mkbuiltins: unrecognized option: $1" 1>&2 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
41 exit 1 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
42 ;; |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
43 esac |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
44 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
45 if $make_header; then |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
46 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
47 cat << \EOF |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
48 // DO NOT EDIT! Generated automatically by mkbuiltins. |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
49 |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
50 #if ! defined (octave_builtin_defun_decls_h) |
15419
2afbe4295682
correct name of include guard in generated builtin-defun-decls.h file
John W. Eaton <jwe@octave.org>
parents:
15418
diff
changeset
|
51 #define octave_builtin_defun_decls_h 1 |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
52 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
53 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20940
diff
changeset
|
54 |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
55 #include "ovl.h" |
15422
57e685d135ec
include oct-obj.h in generated builtin-defun-decls.h file
John W. Eaton <jwe@octave.org>
parents:
15419
diff
changeset
|
56 |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
57 #define DEFUN_DECL(name) \ |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
58 extern OCTINTERP_API octave_value_list \ |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
59 name (const octave_value_list& = octave_value_list (), int = 0); |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
60 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
61 EOF |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
62 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
63 $SED -n -e 's/ *\(XDEFUN\|XDEFCONSTFUN\)_INTERNAL *( *\([_A-Za-z][_A-Za-z0-9]*\) *,.*$/DEFUN_DECL (F\2);/p; s/^ *XDEFUNX_INTERNAL *( *"\([_A-Za-z][_A-Za-z0-9]*\)" *,.*$/DEFUN_DECL (F\1);/p' "$@" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
64 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
65 cat << \EOF |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
66 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
67 #undef DEFUN_DECL |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
68 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
69 #endif |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
70 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
71 EOF |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
72 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
73 else |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
74 |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
75 cat << \EOF |
2335 | 76 // DO NOT EDIT! Generated automatically by mkbuiltins. |
77 | |
78 #ifdef HAVE_CONFIG_H | |
15268
307912900544
Use angle brackets for #include <config.h> for consistency.
Rik <rik@octave.org>
parents:
15195
diff
changeset
|
79 #include <config.h> |
2335 | 80 #endif |
81 | |
2968 | 82 #include "defun.h" |
15470
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15422
diff
changeset
|
83 #include "help.h" |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
84 #include "ovl.h" |
2335 | 85 #include "variables.h" |
7210 | 86 #include "builtins.h" |
2335 | 87 |
3399 | 88 #if defined (quad) |
89 #undef quad | |
90 #endif | |
91 | |
4128 | 92 #if defined (ENABLE_DYNAMIC_LINKING) |
5796 | 93 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
94 #define XDEFUN_DLD_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 95 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
96 #define XDEFUNX_DLD_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 97 |
3364 | 98 #else |
5796 | 99 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
100 #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
|
101 XDEFUN_INTERNAL(name, args_name, nargout_name, doc) |
5796 | 102 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
103 #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
|
104 XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) |
5796 | 105 |
3364 | 106 #endif |
107 | |
15004
ea6997657614
which: provide source file name for built-in functions
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
108 #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
|
109 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
|
110 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
111 #define XDEFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
3295 | 112 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
|
113 install_builtin_function (F ## name, #name, file, doc); \ |
4234 | 114 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
115 #define XDEFCONSTFUN_INTERNAL(name, args_name, nargout_name, doc) \ |
4234 | 116 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
|
117 install_builtin_function (F ## name, #name, file, doc, false); \ |
3295 | 118 |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
119 #define XDEFUNX_INTERNAL(name, fname, args_name, nargout_name, doc) \ |
3744 | 120 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
|
121 install_builtin_function (fname, name, file, doc); \ |
3744 | 122 |
3295 | 123 #define XDEFALIAS_INTERNAL(alias, name) \ |
124 alias_builtin (#alias, #name); | |
125 | |
3321 | 126 #define XDEFCONST_INTERNAL(name, defn, doc) |
3295 | 127 |
2373 | 128 EOF |
129 | |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
130 for arg |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
131 do |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
132 fcn=`echo "$arg" | $SED 's,.*/,,; s/\.df//; s/-/_/g;'` |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
133 echo "static void" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
134 echo "install_${fcn}_fcns (void)" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
135 echo "{" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
136 cat "$arg" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
137 echo "}" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
138 echo "" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
139 done |
2907 | 140 |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
141 cat << \EOF |
2907 | 142 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
143 void |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7210
diff
changeset
|
144 install_builtins (void) |
2335 | 145 { |
146 EOF | |
147 | |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
148 for arg |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
149 do |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
150 fcn=`echo "$arg" | $SED 's,.*/,,; s/\.df//; s/-/_/g;'` |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
151 echo " install_${fcn}_fcns ();" |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
152 done |
2335 | 153 |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
154 cat << \EOF |
15470
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15422
diff
changeset
|
155 |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15422
diff
changeset
|
156 install_built_in_docstrings (); |
2335 | 157 } |
158 | |
159 EOF | |
160 | |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
161 fi |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
162 |
2335 | 163 exit 0 |