changeset 24189:7a2cecc1ec24

edit.m: use the bare name for header and function prototype (bug #52316) * edit.m: use the bare name in auto generated prototype. Remove trailing white space after "-*- texinfo -*-" in m files function prototype
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 31 Oct 2017 13:02:01 +0100
parents 1253132e2173
children 90fe16a3a5a1
files scripts/miscellaneous/edit.m
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/edit.m	Mon Oct 30 21:22:15 2017 -0700
+++ b/scripts/miscellaneous/edit.m	Tue Oct 31 13:02:01 2017 +0100
@@ -459,6 +459,7 @@
     endswitch
 
     ## Generate the function template.
+    [~, basename] = fileparts (name);
     exists = exist (name);
     switch (ext)
       case {"cc", "C", "cpp"}
@@ -474,9 +475,9 @@
           code = " ";
         endif
         body = ["#include <octave/oct.h>\n\n"             ...
-                "DEFUN_DLD(" name ", args, nargout,\n"    ...
+                "DEFUN_DLD(" basename ", args, nargout,\n"...
                 "          \"-*- texinfo -*-\\n\\\n"      ...
-                "@deftypefn {} {@var{retval} =} " name    ...
+                "@deftypefn {} {@var{retval} =} " basename...
                 " (@var{input1}, @var{input2})\\n\\\n"    ...
                 "@seealso{}\\n\\\n@end deftypefn\")\n{\n" ...
                 "  octave_value_list retval;\n"           ...
@@ -489,19 +490,19 @@
         if (any (exists == [2, 103]))
           body = type (name){1};
         else
-          body = ["function [retval] = " name " (input1, input2)\n\n" ...
+          body = ["function [retval] = " basename " (input1, input2)\n\n" ...
                   "endfunction\n"];
         endif
         if (isempty (head))
-          comment = ["## -*- texinfo -*- \n## @deftypefn {} " ...
-                     "{@var{retval} =} " name                              ...
+          comment = ["## -*- texinfo -*-\n## @deftypefn {} " ...
+                     "{@var{retval} =} " basename                          ...
                      " (@var{input1}, @var{input2})\n##\n"                 ...
                      "## @seealso{}\n## @end deftypefn\n\n"                ...
                      "## " strrep(tail, "\n", "\n## ") "\n\n"];
         else
           comment = ["## " strrep(head,"\n","\n## ") "\n\n"                ...
                      "## -*- texinfo -*- \n## @deftypefn {} " ...
-                     "{@var{retval} =} " name                              ...
+                     "{@var{retval} =} " basename                          ...
                      " (@var{input1}, @var{input2})\n##\n"                 ...
                      "## @seealso{}\n## @end deftypefn\n\n"                ...
                      "## " strrep(tail, "\n", "\n## ") "\n\n"];