annotate libinterp/mk-builtins.pl @ 33603:ea261407cb9f bytecode-interpreter tip

maint: Merge default to bytecode-interpreter
author Arun Giridhar <arungiridhar@gmail.com>
date Sat, 18 May 2024 17:42:42 -0400
parents 2e484f9f1f18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 ##
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31771
diff changeset
5 ## Copyright (C) 1996-2024 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
4a9feb849125 [project @ 1996-07-19 02:51:02 by jwe]
jwe
parents:
diff changeset
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
02fcb550f20c [project @ 2003-01-16 20:15:14 by jwe]
jwe
parents: 4234
diff changeset
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
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
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
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
89 $name = $2;
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
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
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
95 if ($is_method)
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
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
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
98 }
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
99 else
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
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
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
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
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
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
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30655
diff changeset
119 OCTAVE_BEGIN_NAMESPACE(octave)
29958
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
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30655
diff changeset
151 print "\nOCTAVE_END_NAMESPACE(octave)\n";
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29952
diff changeset
152
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29952
diff changeset
153 print "\n#endif\n";
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
154 }
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
155 elsif ($make_source)
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
156 {
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
157 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
158
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
159 #if defined (HAVE_CONFIG_H)
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
160 # include \"config.h\"
15418
60090630cb76 generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents: 15268
diff changeset
161 #endif
60090630cb76 generate declarations for all built-in DEFUN functions
John W. Eaton <jwe@octave.org>
parents: 15268
diff changeset
162
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
163 #include \"builtin-defun-decls.h\"
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
164 #include \"help.h\"
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
165 #include \"ovl.h\"
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
166 #include \"symtab.h\"
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
167 #include \"variables.h\"
2335
4a9feb849125 [project @ 1996-07-19 02:51:02 by jwe]
jwe
parents:
diff changeset
168
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30655
diff changeset
169 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30655
diff changeset
170
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30655
diff changeset
171 ";
3399
e665633c76af [project @ 1999-12-22 22:11:50 by jwe]
jwe
parents: 3364
diff changeset
172
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
173 @installer_functions = ();
5796
20f4bd627a74 [project @ 2006-05-09 02:04:54 by jwe]
jwe
parents: 5794
diff changeset
174
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
175 foreach $arg (@ARGV)
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
176 {
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
177 $file = $arg;
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents: 3225
diff changeset
178
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
179 if (! -f $file)
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
180 {
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
181 $file = "$srcdir/$file";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
182 }
2373
d423dcc0ac32 [project @ 1996-10-12 00:19:58 by jwe]
jwe
parents: 2335
diff changeset
183
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
184 ($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
185 $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
186 $fcn =~ s/-/_/g;
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
187 $fcn = "install_${fcn}_fcns";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
188
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
189 $fcn_header = "\n static void
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
190 $fcn (symbol_table& symtab)
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
191 {
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
192 std::string file = \"$arg\";";
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
193
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
194 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
195
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
196 ## 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
197 ## 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
198
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
199 $type = "";
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
200 $const_param = "";
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
201 $fname = "";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
202 $name = "";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
203 $alias = "";
24726
10c7e236a567 * mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
204 $fcn_body = "";
22002
40e9cb6bd95c avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents: 22001
diff changeset
205
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
206 %dispatch_map = ();
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
207
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
208 while ($line = <$fh>)
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
209 {
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
210 if ($line =~ /^ *DEF(METHOD|UN) *\( *([^ ,]*) *,.*$/)
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
211 {
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
212 $type = "fun";
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
213 $fname = "F$2";
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
214 $name = "$2";
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
215 }
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
216 elsif ($line =~ /^ *DEF(METHOD|UN)X *\( *"([^"]*)" *, *([^ ,]*) *,.*$/)
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
217 {
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
218 $type = "fun";
23518
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
219 $fname = "$3";
8744d4ed8fb4 provide DEFMETHOD macros
John W. Eaton <jwe@octave.org>
parents: 23419
diff changeset
220 $name = "$2";
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
221 }
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
222 elsif ($line =~ /^ *DEFALIAS *\( *([^ ,]*) *, *([^ )]*) *\).*$/)
22892
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 $type = "alias";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
225 $alias = "$1";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
226 $name = "$2";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
227 }
22002
40e9cb6bd95c avoid macros in generated built-in function files
John W. Eaton <jwe@octave.org>
parents: 22001
diff changeset
228
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
229 if ($type eq "fun")
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
230 {
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
231 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
232 {
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
233 $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
234 $line =~ s/\s*$//;
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
235 @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
236
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
237 $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
238 }
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
239
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
240 ## 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
241 ## the docstring for aliases to this function.
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
242
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
243 $fcn_body .= "\n symtab.install_built_in_function (\"$name\", octave_value (new octave_builtin ($fname, \"$name\", file, \"external-doc:$name\")));";
2907
8bb31a2b480b [project @ 1997-04-30 05:01:46 by jwe]
jwe
parents: 2890
diff changeset
244
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
245 $type = "";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
246 $fname = "";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
247 $name = "";
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
248 $const_param = "";
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
249 }
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
250 elsif ($type eq "alias")
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
251 {
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
252 $fcn_body .= "\n symtab.alias_built_in_function (\"$alias\", \"$name\");";
2907
8bb31a2b480b [project @ 1997-04-30 05:01:46 by jwe]
jwe
parents: 2890
diff changeset
253
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
254 ## 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
255 ## original function.
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
256
22896
8fb46f48c548 eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents: 22893
diff changeset
257 if (exists $dispatch_map{$name})
8fb46f48c548 eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents: 22893
diff changeset
258 {
8fb46f48c548 eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents: 22893
diff changeset
259 @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
260
22896
8fb46f48c548 eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents: 22893
diff changeset
261 if (@classes)
8fb46f48c548 eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents: 22893
diff changeset
262 {
8fb46f48c548 eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents: 22893
diff changeset
263 $dispatch_map{$alias} = [@classes];
8fb46f48c548 eliminate warnings from mk-builtins.pl
John W. Eaton <jwe@octave.org>
parents: 22893
diff changeset
264 }
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
265 }
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
266
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
267 $type = "";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
268 $name = "";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
269 $alias = "";
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
270 }
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
271 }
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
272
23419
75a4b9a34999 Ensure generated source files are deterministic and reproducible
Mike Miller <mtmiller@octave.org>
parents: 23220
diff changeset
273 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
274 {
24726
10c7e236a567 * mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
275 $dispatch_code = "";
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
276
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
277 @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
278
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
279 foreach $class (@classes)
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
280 {
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
281 $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
282 }
24726
10c7e236a567 * mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
283
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
284 if ($dispatch_code)
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
285 {
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
286 $fcn_body .= "\n$dispatch_code";
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
287 }
22893
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
288 }
5ff6716cf157 allow dispatch types to be declared for built-in functions
John W. Eaton <jwe@octave.org>
parents: 22892
diff changeset
289
24726
10c7e236a567 * mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
290 if ($fcn_body)
10c7e236a567 * mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
291 {
10c7e236a567 * mk-builtins.pl: Don't generate functions that do nothing.
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
292 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
293
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
294 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
295 }
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
296 }
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
297
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
298 print "
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
299 void
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31707
diff changeset
300 symbol_table::install_builtins ()
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
301 {
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
302 ";
2335
4a9feb849125 [project @ 1996-07-19 02:51:02 by jwe]
jwe
parents:
diff changeset
303
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
304 foreach $fcn (@installer_functions)
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
305 {
24727
11e359eb63f4 move install_builtins function inside symbol_table class
John W. Eaton <jwe@octave.org>
parents: 24726
diff changeset
306 print " $fcn (*this);\n"
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
307 }
2335
4a9feb849125 [project @ 1996-07-19 02:51:02 by jwe]
jwe
parents:
diff changeset
308
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30655
diff changeset
309 print " }\n";
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30655
diff changeset
310 print "OCTAVE_END_NAMESPACE(octave)\n";
22892
5521b8a271ae rewrite mk-builtins script in Perl
John W. Eaton <jwe@octave.org>
parents: 22825
diff changeset
311 }