Mercurial > octave
annotate libinterp/mk-builtins.pl @ 30564:796f54d4ddbf stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
In all .txi and .texi files except gpl.txi and gpl.texi in the
doc/liboctave and doc/interpreter directories, change the copyright
to "Octave Project Developers", the same as used for other source
files. Update copyright notices for 2022 (not done since 2019). For
gpl.txi and gpl.texi, change the copyright notice to be "Free Software
Foundation, Inc." and leave the date at 2007 only because this file
only contains the text of the GPL, not anything created by the Octave
Project Developers.
Add Paul Thomas to contributors.in.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 28 Dec 2021 18:22:40 -0500 |
parents | febddcd0f227 |
children | ac74380e9d46 |
rev | line source |
---|---|
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
1 #! /usr/bin/perl -w |
29357
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
2 |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 ######################################################################## |
29357
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
4 ## |
30564
796f54d4ddbf
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29972
diff
changeset
|
5 ## Copyright (C) 1996-2022 The Octave Project Developers |
29357
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
6 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
7 ## See the file COPYRIGHT.md in the top-level directory of this |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
8 ## distribution or <https://octave.org/copyright/>. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
9 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
10 ## This file is part of Octave. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
11 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
12 ## Octave is free software: you can redistribute it and/or modify it |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
13 ## under the terms of the GNU General Public License as published by |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
14 ## the Free Software Foundation, either version 3 of the License, or |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
15 ## (at your option) any later version. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
16 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
17 ## Octave is distributed in the hope that it will be useful, but |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
18 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
19 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
20 ## GNU General Public License for more details. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
21 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
22 ## You should have received a copy of the GNU General Public License |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
23 ## along with Octave; see the file COPYING. If not, see |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
24 ## <https://www.gnu.org/licenses/>. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
25 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
26 ######################################################################## |
2335 | 27 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
28 $make_header = 0; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
29 $make_source = 0; |
4299 | 30 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
31 $have_options = 1; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
32 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
33 while ($have_options) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
34 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
35 $opt = shift (@ARGV); |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
36 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
37 if ($opt eq "--header") |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
38 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
39 die "mk-builtins.pl: only one of --header or --source may be specified" if ($make_source); |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
40 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
41 $make_header = 1; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
42 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
43 elsif ($opt eq "--source") |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
44 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
45 die "mk-builtins.pl: only one of --header or --source may be specified" if ($make_header); |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
46 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
47 $make_source = 1; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
48 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
49 else |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
50 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
51 $srcdir = "$opt"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
52 $opt = shift (@ARGV); |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
53 die "mk-builtins.pl: '--' must separate SRCDIR from other file names" if ($opt ne "--"); |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
54 $have_options = 0; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
55 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
56 } |
22002
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
57 |
25882
22ee68edcf3a
require dynamic loading capabilities to build Octave
John W. Eaton <jwe@octave.org>
parents:
25637
diff
changeset
|
58 die "usage: mk-builtins.pl --header|--source SRCDIR -- f1 f2 ..." if (! @ARGV); |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
59 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
60 die "mk-builtins.pl: one of --header or --source must be specified" if (! $make_header && ! $make_source); |
22095
6119019d42f6
move find-defun-files.sh and mkbuiltins to build-aux directory
John W. Eaton <jwe@octave.org>
parents:
22002
diff
changeset
|
61 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
62 if ($make_header) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
63 { |
29952
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
64 @method_names = (); |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
65 @fcn_names = (); |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
66 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
67 while ($file = shift (@ARGV)) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
68 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
69 if (! -f $file) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
70 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
71 $file = "$srcdir/$file"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
72 } |
21966
112b20240c87
move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
73 |
22002
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
74 ## Generate a list of function names to declare. We could do |
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
75 ## this in one step, but this way keeps the sed patterns a |
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
76 ## bit smaller. |
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
77 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
78 open($fh, "<", $file) || die "mk-builtins.pl: failed to open file $file\n"; |
22002
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
79 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
80 while (<$fh>) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
81 { |
29968
7aa4d8c049e5
eliminate obsolete DEFCONSTFUN and DEFCONSTMETHOD macros
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
82 if (/^[ \t]*DEF(METHOD|UN)[ \t]*\( *([^ ,]*).*$/) |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
83 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
84 $name = "F$2"; |
29968
7aa4d8c049e5
eliminate obsolete DEFCONSTFUN and DEFCONSTMETHOD macros
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
85 $is_method = ($1 eq "METHOD"); |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
86 } |
23518 | 87 elsif (/^[ \t]*DEF(METHOD|UN)X[ \t]*\( *"[^"]*" *, *([^ ,]*).*$/) |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
88 { |
23518 | 89 $name = $2; |
90 $is_method = ($1 eq "METHOD"); | |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
91 } |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
92 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
93 if ($name) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
94 { |
23518 | 95 if ($is_method) |
96 { | |
29952
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
97 push (@method_names, $name); |
23518 | 98 } |
99 else | |
100 { | |
29952
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
101 push (@fcn_names, $name); |
23518 | 102 } |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
103 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
104 $name = ""; |
23518 | 105 $is_method = 0; |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
106 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
107 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
108 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
109 |
29952
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
110 print "// DO NOT EDIT! Generated automatically by mk-builtins.pl. |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
111 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
112 #if ! defined (octave_builtin_defun_decls_h) |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
113 #define octave_builtin_defun_decls_h 1 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
114 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
115 #include \"octave-config.h\" |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
116 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
117 #include \"ovl.h\" |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
118 |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
119 OCTAVE_NAMESPACE_BEGIN |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
120 |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
121 class interpreter; |
29952
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
122 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
123 "; |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
124 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
125 if ($#method_names) |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
126 { |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
127 print "// Methods\n\n"; |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
128 } |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
129 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
130 foreach $name (sort (@method_names)) |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
131 { |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
132 print "extern OCTINTERP_API octave_value_list |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
133 $name (octave::interpreter&, const octave_value_list& = octave_value_list (), int = 0); |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
134 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
135 "; |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
136 } |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
137 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
138 if ($#fcn_names) |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
139 { |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
140 print "// Functions\n\n"; |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
141 } |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
142 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
143 foreach $name (sort (@fcn_names)) |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
144 { |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
145 print "extern OCTINTERP_API octave_value_list |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
146 $name (const octave_value_list& = octave_value_list (), int = 0); |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
147 |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
148 "; |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
149 } |
f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
150 |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
151 print "\nOCTAVE_NAMESPACE_END\n"; |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
152 |
29972
febddcd0f227
fix macro name in generated builtin-defun-decls.h file
John W. Eaton <jwe@octave.org>
parents:
29968
diff
changeset
|
153 print "\n#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)\n\n"; |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
154 |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
155 foreach $name (sort (@method_names)) |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
156 { |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
157 print "OCTAVE_DEPRECATED (7, \"use 'octave::$name' instead\") |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
158 inline octave_value_list |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
159 $name (octave::interpreter& interp, const octave_value_list& args = octave_value_list (), int nargout = 0) |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
160 { |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
161 return octave::$name (interp, args, nargout); |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
162 } |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
163 |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
164 "; |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
165 } |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
166 |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
167 foreach $name (sort (@fcn_names)) |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
168 { |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
169 print "OCTAVE_DEPRECATED (7, \"use 'octave::$name' instead\") |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
170 inline octave_value_list |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
171 $name (const octave_value_list& args = octave_value_list (), int nargout = 0) |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
172 { |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
173 return octave::$name (args, nargout); |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
174 } |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
175 |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
176 "; |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
177 } |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
178 |
29972
febddcd0f227
fix macro name in generated builtin-defun-decls.h file
John W. Eaton <jwe@octave.org>
parents:
29968
diff
changeset
|
179 ## end OCTAVE_PROVIDE_DEPRECATED_SYMBOLS block |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
180 print "\n\n#endif\n"; |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
181 |
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29952
diff
changeset
|
182 print "\n#endif\n"; |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
183 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
184 elsif ($make_source) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
185 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
186 print "// DO NOT EDIT! Generated automatically by mk-builtins.pl. |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
187 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
188 #if defined (HAVE_CONFIG_H) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
189 # include \"config.h\" |
15418
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
190 #endif |
60090630cb76
generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents:
15268
diff
changeset
|
191 |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
192 #include \"builtin-defun-decls.h\" |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
193 #include \"help.h\" |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
194 #include \"ovl.h\" |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
195 #include \"symtab.h\" |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
196 #include \"variables.h\" |
2335 | 197 |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
198 namespace octave |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
199 {"; |
3399 | 200 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
201 @installer_functions = (); |
5796 | 202 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
203 foreach $arg (@ARGV) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
204 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
205 $file = $arg; |
3295 | 206 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
207 if (! -f $file) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
208 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
209 $file = "$srcdir/$file"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
210 } |
2373 | 211 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
212 ($fcn = $arg) =~ s,.*/,,; |
25637
e1c3d1c6e896
don't substitute api.prefix style in bison input files
John W. Eaton <jwe@octave.org>
parents:
25054
diff
changeset
|
213 $fcn =~ s/\.(cc|cpp|in\.cc|yy|ll)$//; |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
214 $fcn =~ s/-/_/g; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
215 $fcn = "install_${fcn}_fcns"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
216 |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
217 $fcn_header = "\n static void |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
218 $fcn (symbol_table& symtab) |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
219 { |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
220 std::string file = \"$arg\";"; |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
221 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
222 open($fh, "<", $file) || die "mk-builtins.pl: failed to open file $file\n"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
223 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
224 ## Find DEFUN or DEFALIAS macros and generate the function calls that |
22002
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
225 ## install the built-in functions or function aliases. |
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
226 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
227 $type = ""; |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
228 $const_param = ""; |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
229 $fname = ""; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
230 $name = ""; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
231 $alias = ""; |
24726
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
232 $fcn_body = ""; |
22002
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
233 |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
234 %dispatch_map = (); |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
235 |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
236 while ($line = <$fh>) |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
237 { |
23518 | 238 if ($line =~ /^ *DEF(METHOD|UN) *\( *([^ ,]*) *,.*$/) |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
239 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
240 $type = "fun"; |
23518 | 241 $fname = "F$2"; |
242 $name = "$2"; | |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
243 } |
23518 | 244 elsif ($line =~ /^ *DEF(METHOD|UN)X *\( *"([^"]*)" *, *([^ ,]*) *,.*$/) |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
245 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
246 $type = "fun"; |
23518 | 247 $fname = "$3"; |
248 $name = "$2"; | |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
249 } |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
250 elsif ($line =~ /^ *DEFALIAS *\( *([^ ,]*) *, *([^ )]*) *\).*$/) |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
251 { |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
252 $type = "alias"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
253 $alias = "$1"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
254 $name = "$2"; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
255 } |
22002
40e9cb6bd95c
avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents:
22001
diff
changeset
|
256 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
257 if ($type eq "fun") |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
258 { |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
259 if (($line = <$fh>) =~ /^ *classes:/) |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
260 { |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
261 $line =~ s/\s*classes:\s*//; |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
262 $line =~ s/\s*$//; |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
263 @classes = split (/\s+/, $line); |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
264 |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
265 $dispatch_map{$name} = [@classes]; |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
266 } |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
267 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
268 ## We use the name appended to the "external-doc" tag to find |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
269 ## the docstring for aliases to this function. |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
270 |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
271 $fcn_body .= "\n symtab.install_built_in_function (\"$name\", octave_value (new octave_builtin ($fname, \"$name\", file, \"external-doc:$name\")));"; |
2907 | 272 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
273 $type = ""; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
274 $fname = ""; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
275 $name = ""; |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
276 $const_param = ""; |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
277 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
278 elsif ($type eq "alias") |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
279 { |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
280 $fcn_body .= "\n symtab.alias_built_in_function (\"$alias\", \"$name\");"; |
2907 | 281 |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
282 ## Preserve dispatch info (if any) that we have for the |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
283 ## original function. |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
284 |
22896
8fb46f48c548
eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents:
22893
diff
changeset
|
285 if (exists $dispatch_map{$name}) |
8fb46f48c548
eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents:
22893
diff
changeset
|
286 { |
8fb46f48c548
eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents:
22893
diff
changeset
|
287 @classes = @{$dispatch_map{$name}}; |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
288 |
22896
8fb46f48c548
eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents:
22893
diff
changeset
|
289 if (@classes) |
8fb46f48c548
eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents:
22893
diff
changeset
|
290 { |
8fb46f48c548
eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents:
22893
diff
changeset
|
291 $dispatch_map{$alias} = [@classes]; |
8fb46f48c548
eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents:
22893
diff
changeset
|
292 } |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
293 } |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
294 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
295 $type = ""; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
296 $name = ""; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
297 $alias = ""; |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
298 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
299 } |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
300 |
23419
75a4b9a34999
Ensure generated source files are deterministic and reproducible
Mike Miller <mtmiller@octave.org>
parents:
23220
diff
changeset
|
301 foreach $fcn (sort (keys (%dispatch_map))) |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
302 { |
24726
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
303 $dispatch_code = ""; |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
304 |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
305 @classes = @{$dispatch_map{$fcn}}; |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
306 |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
307 foreach $class (@classes) |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
308 { |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
309 $dispatch_code .= "\n symtab.install_built_in_dispatch (\"$fcn\", \"$class\");"; |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
310 } |
24726
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
311 |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
312 if ($dispatch_code) |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
313 { |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
314 $fcn_body .= "\n$dispatch_code"; |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
315 } |
22893
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
316 } |
5ff6716cf157
allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents:
22892
diff
changeset
|
317 |
24726
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
318 if ($fcn_body) |
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
319 { |
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
320 push (@installer_functions, $fcn); |
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
321 |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
322 print "$fcn_header\n$fcn_body\n }\n"; |
24726
10c7e236a567
* mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
323 } |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
324 } |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
325 |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
326 print " |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
327 void |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
328 symbol_table::install_builtins (void) |
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
329 { |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
330 "; |
2335 | 331 |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
332 foreach $fcn (@installer_functions) |
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
333 { |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
334 print " $fcn (*this);\n" |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
335 } |
2335 | 336 |
24727
11e359eb63f4
move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents:
24726
diff
changeset
|
337 print " }\n}\n"; |
22892
5521b8a271ae
rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents:
22825
diff
changeset
|
338 } |