Mercurial > octave
changeset 29952:f2eaf14ff6c3
mk-builtins.pl: Separate fcn name collection and code generation steps.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Aug 2021 10:25:13 -0400 |
parents | 381082ed261d |
children | e35442c969f5 |
files | libinterp/mk-builtins.pl |
diffstat | 1 files changed, 46 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/mk-builtins.pl Sat Aug 14 08:43:55 2021 -0400 +++ b/libinterp/mk-builtins.pl Sat Aug 14 10:25:13 2021 -0400 @@ -61,21 +61,8 @@ if ($make_header) { - print "// DO NOT EDIT! Generated automatically by mk-builtins.pl. - -#if ! defined (octave_builtin_defun_decls_h) -#define octave_builtin_defun_decls_h 1 - -#include \"octave-config.h\" - -#include \"ovl.h\" - -namespace octave -{ - class interpreter; -} - -"; + @method_names = (); + @fcn_names = (); while ($file = shift (@ARGV)) { @@ -107,15 +94,11 @@ { if ($is_method) { - print "extern OCTINTERP_API octave_value_list -$name (octave::interpreter&, const octave_value_list& = octave_value_list (), int = 0); -"; + push (@method_names, $name); } else { - print "extern OCTINTERP_API octave_value_list -$name (const octave_value_list& = octave_value_list (), int = 0); -"; + push (@fcn_names, $name); } $name = ""; @@ -124,6 +107,48 @@ } } + print "// DO NOT EDIT! Generated automatically by mk-builtins.pl. + +#if ! defined (octave_builtin_defun_decls_h) +#define octave_builtin_defun_decls_h 1 + +#include \"octave-config.h\" + +#include \"ovl.h\" + +namespace octave +{ + class interpreter; +} + +"; + + if ($#method_names) + { + print "// Methods\n\n"; + } + + foreach $name (sort (@method_names)) + { + print "extern OCTINTERP_API octave_value_list +$name (octave::interpreter&, const octave_value_list& = octave_value_list (), int = 0); + +"; + } + + if ($#fcn_names) + { + print "// Functions\n\n"; + } + + foreach $name (sort (@fcn_names)) + { + print "extern OCTINTERP_API octave_value_list +$name (const octave_value_list& = octave_value_list (), int = 0); + +"; + } + print "#endif\n"; } elsif ($make_source)