# HG changeset patch # User John W. Eaton # Date 1628951113 14400 # Node ID f2eaf14ff6c317ef35d8e71ade8a164023b7f7db # Parent 381082ed261d4786e588d8a1a6a32185b788eed3 mk-builtins.pl: Separate fcn name collection and code generation steps. diff -r 381082ed261d -r f2eaf14ff6c3 libinterp/mk-builtins.pl --- 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)