Mercurial > hg > octave-nkf
changeset 15561:77795b0ed263
maint: Rename unimplemented.m to __unimplemented__.m.
* resource-manager.cc(octave_keywords): Change unimplemented.m to
__unimplemented__.m.
* variables.cc: Change variable Vmissing_function_hook to __unimplemented__.
* scripts/help/module.mk: Change unimplemented.m to __unimplemented__.m in
list of FCN_FILES.
author | Juan Pablo Carbajal <ajuanpi+dev@gmail.com> |
---|---|
date | Thu, 25 Oct 2012 12:37:02 -0700 |
parents | 305ad0a215ba |
children | ba5956503707 |
files | libgui/src/resource-manager.cc libinterp/interpfcn/variables.cc scripts/help/__unimplemented__.m scripts/help/module.mk scripts/help/unimplemented.m |
diffstat | 5 files changed, 432 insertions(+), 432 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/resource-manager.cc +++ b/libgui/src/resource-manager.cc @@ -311,6 +311,7 @@ "__sort_rows_idx__ " "__strip_html_tags__ " "__token_count__ " + "__unimplemented__ " "__varval__ " "__version_info__ " "__voronoi__ " @@ -1638,7 +1639,6 @@ "unifinv " "unifpdf " "unifrnd " - "unimplemented " "union " "unique " "unix "
--- a/libinterp/interpfcn/variables.cc +++ b/libinterp/interpfcn/variables.cc @@ -2536,7 +2536,7 @@ return SET_INTERNAL_VARIABLE (whos_line_format); } -static std::string Vmissing_function_hook = "unimplemented"; +static std::string Vmissing_function_hook = "__unimplemented__"; DEFUN (missing_function_hook, args, nargout, "-*- texinfo -*-\n\
new file mode 100644 --- /dev/null +++ b/scripts/help/__unimplemented__.m @@ -0,0 +1,429 @@ +## Copyright (C) 2010-2012 John W. Eaton +## Copyright (C) 2010 VZLU Prague +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or (at +## your option) any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{txt} =} unimplemented (@var{fcn}) +## Return specific help text for the unimplemented function @var{fcn}. +## This is usually a suggestion for an existing compatible function to use in +## place of @var{fcn}. +## +## This function is not called by users, but by the Octave interpreter when +## it fails to recognize an input string as a valid function name. See +## @code{missing_function_hook} for using a different handler for this event. +## @seealso{missing_function_hook} +## @end deftypefn + + +function txt = __unimplemented__ (fcn) + + if (nargin != 1) + print_usage (); + endif + + is_matlab_function = true; + + ## Some smarter cases, add more as needed. + switch (fcn) + + case "quad2d" + txt = ["quad2d is not implemented. Consider using dblquad."]; + + case "gsvd" + txt = ["gsvd is not currently part of core Octave. See the ",... + "linear-algebra package at ",... + "@url{http://octave.sourceforge.net/linear-algebra/}."]; + + case "funm" + txt = ["funm is not currently part of core Octave. See the ",... + "linear-algebra package at @url{http://octave.sf.net/linear-algebra/}."]; + + case "linprog" + txt = ["Octave does not currently provide linprog. ",... + "Linear programming problems may be solved using @code{glpk}. ",... + "Try @code{help glpk} for more info."]; + + case {"ode113", "ode15i", "ode15s", "ode23", "ode23s", "ode23t", "ode45", "odeget", "odeset"} + txt = ["Octave provides lsode for solving differential equations. ",... + "For more information try @code{help lsode}. ",... + "Matlab-compatible ODE functions are provided by the odepkg package. ",... + "See @url{http://octave.sourceforge.net/odepkg/}."]; + + case {"javaArray", "javaMethod", "javaMethodEDT", "javaObject", "javaObjectEDT", "javaaddpath", "javaclasspath", "javarmpath"} + txt = ["Java objects and methods can be used with the java package. ",... + "See @url{http://octave.sf.net/java/}."]; + + case {"errordlg", "helpdlg", "inputdlg", "listdlg", "questdlg", "warndlg"} + txt = ["Several dialog functions are provided in the java package. ",... + "See @url{http://octave.sf.net/java/}."]; + + case {"xlsread", "xlsfinfo", "xlswrite", "wk1read", "wk1finfo", "wk1write"} + txt = ["Functions for spreadsheet style I/O (.xls .xlsx .sxc .ods .dbf .wk1 etc.) " , ... + "are provided in the io package. ",... + "See @url{http://octave.sf.net/io/}."]; + + case {"avifile", "aviinfo", "aviread"} + txt = ["Basic video file support is provided in the video package. ",... + "See @url{http://octave.sf.net/video/}."]; + + otherwise + if (ismember (fcn, missing_functions ())) + txt = sprintf ("the '%s' function is not yet implemented in Octave", fcn); + else + is_matlab_function = false; + txt = ""; + endif + endswitch + + if (is_matlab_function) + txt = [txt, "\n\n@noindent\nPlease read ",... + "@url{http://www.octave.org/missing.html} to learn how ",... + "you can contribute missing functionality."]; + txt = __makeinfo__ (txt); + endif + + if (nargout == 0) + warning ("Octave:missing-function", "%s", txt); + endif + +endfunction + +function list = missing_functions () + persistent list = { + "DelaunayTri", + "MException", + "RandStream", + "TriRep", + "TriScatteredInterp", + "align", + "alim", + "alpha", + "alphamap", + "annotation", + "audiodevinfo", + "audioplayer", + "audiorecorder", + "aufinfo", + "auread", + "auwrite", + "bar3", + "bar3h", + "bench", + "bicgstabl", + "brush", + "builddocsearchdb", + "bvp4c", + "bvp5c", + "bvpget", + "bvpinit", + "bvpset", + "bvpxtend", + "callSoapService", + "calllib", + "camdolly", + "cameratoolbar", + "camlight", + "camlookat", + "camorbit", + "campan", + "campos", + "camproj", + "camroll", + "camtarget", + "camup", + "camva", + "camzoom", + "cdf2rdf", + "cdfepoch", + "cdfinfo", + "cdfread", + "cdfwrite", + "cellplot", + "checkin", + "checkout", + "cholinc", + "clearvars", + "clipboard", + "cmopts", + "cmpermute", + "cmunique", + "colordef", + "colormapeditor", + "commandhistory", + "commandwindow", + "condeig", + "coneplot", + "contourslice", + "createClassFromWsdl", + "createSoapMessage", + "customverctrl", + "daqread", + "datacursormode", + "datatipinfo", + "dbmex", + "dde23", + "ddeget", + "ddesd", + "ddeset", + "decic", + "depdir", + "depfun", + "deval", + "dialog", + "dither", + "docopt", + "docsearch", + "dragrect", + "dynamicprops", + "echodemo", + "ellipj", + "ellipke", + "evalc", + "exifread", + "expint", + "export2wsdlg", + "figurepalette", + "filebrowser", + "fill3", + "fitsinfo", + "fitsread", + "flow", + "frame2im", + "freqspace", + "funm", + "gallery", + "gammaincinv", + "getframe", + "getpixelposition", + "grabcode", + "graymon", + "gsvd", + "guidata", + "guide", + "guihandles", + "handle", + "hdf", + "hdf5", + "hdf5info", + "hdf5read", + "hdf5write", + "hdfinfo", + "hdfread", + "hdftool", + "helpbrowser", + "helpdesk", + "helpwin", + "hgexport", + "hgload", + "hgsave", + "hgsetget", + "hgtransform", + "hostid", + "ilu", + "im2frame", + "im2java", + "imapprox", + "imformats", + "import", + "inmem", + "inputParser", + "inspect", + "instrfind", + "instrfindall", + "interpstreamspeed", + "iscom", + "isinterface", + "isjava", + "isocaps", + "isstudent", + "javachk", + "ldl", + "libfunctions", + "libfunctionsview", + "libisloaded", + "libpointer", + "libstruct", + "light", + "lightangle", + "lighting", + "linkaxes", + "linkdata", + "linsolve", + "listfonts", + "loadlibrary", + "lscov", + "lsqr", + "makehgtform", + "material", + "matlabrc", + "maxNumCompThreads", + "memmapfile", + "memory", + "metaclass", + "methodsview", + "minres", + "mlint", + "mlintrpt", + "mmfileinfo", + "mmreader", + "movegui", + "movie", + "movie2avi", + "msgbox", + "multibandread", + "multibandwrite", + "native2unicode", + "noanimate", + "ode113", + "ode15i", + "ode15s", + "ode23", + "ode23s", + "ode23t", + "ode23tb", + "ode45", + "odefile", + "odeget", + "odeset", + "odextend", + "open", + "openfig", + "opengl", + "openvar", + "ordeig", + "ordqz", + "ordschur", + "padecoef", + "pagesetupdlg", + "pan", + "parseSoapResponse", + "path2rc", + "pathtool", + "pcode", + "pdepe", + "pdeval", + "playshow", + "plotbrowser", + "plotedit", + "plottools", + "prefdir", + "preferences", + "printdlg", + "printopt", + "printpreview", + "profsave", + "propedit", + "propertyeditor", + "publish", + "qmr", + "quad2d", + "rbbox", + "reducepatch", + "reducevolume", + "resample", + "root", + "rotate", + "rotate3d", + "selectmoveresize", + "sendmail", + "serial", + "setpixelposition", + "showplottool", + "smooth3", + "snapnow", + "sound", + "soundsc", + "ss2tf", + "stream2", + "stream3", + "streamline", + "streamparticles", + "streamribbon", + "streamslice", + "streamtube", + "strings", + "subvolume", + "superclasses", + "support", + "surf2patch", + "symmlq", + "syntax", + "texlabel", + "textwrap", + "tfqmr", + "timer", + "timerfind", + "timerfindall", + "timeseries", + "toolboxdir", + "tscollection", + "tstool", + "uibuttongroup", + "uicontextmenu", + "uicontrol", + "uigetpref", + "uiimport", + "uiopen", + "uipanel", + "uipushtool", + "uiresume", + "uisave", + "uisetcolor", + "uisetfont", + "uisetpref", + "uistack", + "uitable", + "uitoggletool", + "uitoolbar", + "uiwait", + "undocheckout", + "unicode2native", + "unloadlibrary", + "unmesh", + "userpath", + "validateattributes", + "verLessThan", + "viewmtx", + "visdiff", + "volumebounds", + "waitfor", + "waterfall", + "wavfinfo", + "wavplay", + "wavrecord", + "web", + "whatsnew", + "wk1finfo", + "wk1read", + "wk1write", + "workspace", + "xmlread", + "xmlwrite", + "xslt", + "zoom", + }; +endfunction + + +%!test +%! str = __unimplemented__ ("no_name_function"); +%! assert (isempty (str)); +%! str = __unimplemented__ ("quad2d"); +%! assert (str(1:51), "quad2d is not implemented. Consider using dblquad."); +%! str = __unimplemented__ ("MException"); +%! assert (str(1:58), "the 'MException' function is not yet implemented in Octave");
--- a/scripts/help/module.mk +++ b/scripts/help/module.mk @@ -6,6 +6,7 @@ help_FCN_FILES = \ help/__makeinfo__.m \ + help/__unimplemented__.m \ help/doc.m \ help/gen_doc_cache.m \ help/get_first_help_sentence.m \ @@ -13,7 +14,6 @@ help/lookfor.m \ help/print_usage.m \ help/type.m \ - help/unimplemented.m \ help/which.m \ $(help_PRIVATE_FCN_FILES)
deleted file mode 100644 --- a/scripts/help/unimplemented.m +++ /dev/null @@ -1,429 +0,0 @@ -## Copyright (C) 2010-2012 John W. Eaton -## Copyright (C) 2010 VZLU Prague -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 3 of the License, or (at -## your option) any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, see -## <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## @deftypefn {Function File} {@var{txt} =} unimplemented (@var{fcn}) -## Return specific help text for the unimplemented function @var{fcn}. -## This is usually a suggestion for an existing compatible function to use in -## place of @var{fcn}. -## -## This function is not called by users, but by the Octave interpreter when -## it fails to recognize an input string as a valid function name. See -## @code{missing_function_hook} for using a different handler for this event. -## @seealso{missing_function_hook} -## @end deftypefn - - -function txt = unimplemented (fcn) - - if (nargin != 1) - print_usage (); - endif - - is_matlab_function = true; - - ## Some smarter cases, add more as needed. - switch (fcn) - - case "quad2d" - txt = ["quad2d is not implemented. Consider using dblquad."]; - - case "gsvd" - txt = ["gsvd is not currently part of core Octave. See the ",... - "linear-algebra package at ",... - "@url{http://octave.sourceforge.net/linear-algebra/}."]; - - case "funm" - txt = ["funm is not currently part of core Octave. See the ",... - "linear-algebra package at @url{http://octave.sf.net/linear-algebra/}."]; - - case "linprog" - txt = ["Octave does not currently provide linprog. ",... - "Linear programming problems may be solved using @code{glpk}. ",... - "Try @code{help glpk} for more info."]; - - case {"ode113", "ode15i", "ode15s", "ode23", "ode23s", "ode23t", "ode45", "odeget", "odeset"} - txt = ["Octave provides lsode for solving differential equations. ",... - "For more information try @code{help lsode}. ",... - "Matlab-compatible ODE functions are provided by the odepkg package. ",... - "See @url{http://octave.sourceforge.net/odepkg/}."]; - - case {"javaArray", "javaMethod", "javaMethodEDT", "javaObject", "javaObjectEDT", "javaaddpath", "javaclasspath", "javarmpath"} - txt = ["Java objects and methods can be used with the java package. ",... - "See @url{http://octave.sf.net/java/}."]; - - case {"errordlg", "helpdlg", "inputdlg", "listdlg", "questdlg", "warndlg"} - txt = ["Several dialog functions are provided in the java package. ",... - "See @url{http://octave.sf.net/java/}."]; - - case {"xlsread", "xlsfinfo", "xlswrite", "wk1read", "wk1finfo", "wk1write"} - txt = ["Functions for spreadsheet style I/O (.xls .xlsx .sxc .ods .dbf .wk1 etc.) " , ... - "are provided in the io package. ",... - "See @url{http://octave.sf.net/io/}."]; - - case {"avifile", "aviinfo", "aviread"} - txt = ["Basic video file support is provided in the video package. ",... - "See @url{http://octave.sf.net/video/}."]; - - otherwise - if (ismember (fcn, missing_functions ())) - txt = sprintf ("the '%s' function is not yet implemented in Octave", fcn); - else - is_matlab_function = false; - txt = ""; - endif - endswitch - - if (is_matlab_function) - txt = [txt, "\n\n@noindent\nPlease read ",... - "@url{http://www.octave.org/missing.html} to learn how ",... - "you can contribute missing functionality."]; - txt = __makeinfo__ (txt); - endif - - if (nargout == 0) - warning ("Octave:missing-function", "%s", txt); - endif - -endfunction - -function list = missing_functions () - persistent list = { - "DelaunayTri", - "MException", - "RandStream", - "TriRep", - "TriScatteredInterp", - "align", - "alim", - "alpha", - "alphamap", - "annotation", - "audiodevinfo", - "audioplayer", - "audiorecorder", - "aufinfo", - "auread", - "auwrite", - "bar3", - "bar3h", - "bench", - "bicgstabl", - "brush", - "builddocsearchdb", - "bvp4c", - "bvp5c", - "bvpget", - "bvpinit", - "bvpset", - "bvpxtend", - "callSoapService", - "calllib", - "camdolly", - "cameratoolbar", - "camlight", - "camlookat", - "camorbit", - "campan", - "campos", - "camproj", - "camroll", - "camtarget", - "camup", - "camva", - "camzoom", - "cdf2rdf", - "cdfepoch", - "cdfinfo", - "cdfread", - "cdfwrite", - "cellplot", - "checkin", - "checkout", - "cholinc", - "clearvars", - "clipboard", - "cmopts", - "cmpermute", - "cmunique", - "colordef", - "colormapeditor", - "commandhistory", - "commandwindow", - "condeig", - "coneplot", - "contourslice", - "createClassFromWsdl", - "createSoapMessage", - "customverctrl", - "daqread", - "datacursormode", - "datatipinfo", - "dbmex", - "dde23", - "ddeget", - "ddesd", - "ddeset", - "decic", - "depdir", - "depfun", - "deval", - "dialog", - "dither", - "docopt", - "docsearch", - "dragrect", - "dynamicprops", - "echodemo", - "ellipj", - "ellipke", - "evalc", - "exifread", - "expint", - "export2wsdlg", - "figurepalette", - "filebrowser", - "fill3", - "fitsinfo", - "fitsread", - "flow", - "frame2im", - "freqspace", - "funm", - "gallery", - "gammaincinv", - "getframe", - "getpixelposition", - "grabcode", - "graymon", - "gsvd", - "guidata", - "guide", - "guihandles", - "handle", - "hdf", - "hdf5", - "hdf5info", - "hdf5read", - "hdf5write", - "hdfinfo", - "hdfread", - "hdftool", - "helpbrowser", - "helpdesk", - "helpwin", - "hgexport", - "hgload", - "hgsave", - "hgsetget", - "hgtransform", - "hostid", - "ilu", - "im2frame", - "im2java", - "imapprox", - "imformats", - "import", - "inmem", - "inputParser", - "inspect", - "instrfind", - "instrfindall", - "interpstreamspeed", - "iscom", - "isinterface", - "isjava", - "isocaps", - "isstudent", - "javachk", - "ldl", - "libfunctions", - "libfunctionsview", - "libisloaded", - "libpointer", - "libstruct", - "light", - "lightangle", - "lighting", - "linkaxes", - "linkdata", - "linsolve", - "listfonts", - "loadlibrary", - "lscov", - "lsqr", - "makehgtform", - "material", - "matlabrc", - "maxNumCompThreads", - "memmapfile", - "memory", - "metaclass", - "methodsview", - "minres", - "mlint", - "mlintrpt", - "mmfileinfo", - "mmreader", - "movegui", - "movie", - "movie2avi", - "msgbox", - "multibandread", - "multibandwrite", - "native2unicode", - "noanimate", - "ode113", - "ode15i", - "ode15s", - "ode23", - "ode23s", - "ode23t", - "ode23tb", - "ode45", - "odefile", - "odeget", - "odeset", - "odextend", - "open", - "openfig", - "opengl", - "openvar", - "ordeig", - "ordqz", - "ordschur", - "padecoef", - "pagesetupdlg", - "pan", - "parseSoapResponse", - "path2rc", - "pathtool", - "pcode", - "pdepe", - "pdeval", - "playshow", - "plotbrowser", - "plotedit", - "plottools", - "prefdir", - "preferences", - "printdlg", - "printopt", - "printpreview", - "profsave", - "propedit", - "propertyeditor", - "publish", - "qmr", - "quad2d", - "rbbox", - "reducepatch", - "reducevolume", - "resample", - "root", - "rotate", - "rotate3d", - "selectmoveresize", - "sendmail", - "serial", - "setpixelposition", - "showplottool", - "smooth3", - "snapnow", - "sound", - "soundsc", - "ss2tf", - "stream2", - "stream3", - "streamline", - "streamparticles", - "streamribbon", - "streamslice", - "streamtube", - "strings", - "subvolume", - "superclasses", - "support", - "surf2patch", - "symmlq", - "syntax", - "texlabel", - "textwrap", - "tfqmr", - "timer", - "timerfind", - "timerfindall", - "timeseries", - "toolboxdir", - "tscollection", - "tstool", - "uibuttongroup", - "uicontextmenu", - "uicontrol", - "uigetpref", - "uiimport", - "uiopen", - "uipanel", - "uipushtool", - "uiresume", - "uisave", - "uisetcolor", - "uisetfont", - "uisetpref", - "uistack", - "uitable", - "uitoggletool", - "uitoolbar", - "uiwait", - "undocheckout", - "unicode2native", - "unloadlibrary", - "unmesh", - "userpath", - "validateattributes", - "verLessThan", - "viewmtx", - "visdiff", - "volumebounds", - "waitfor", - "waterfall", - "wavfinfo", - "wavplay", - "wavrecord", - "web", - "whatsnew", - "wk1finfo", - "wk1read", - "wk1write", - "workspace", - "xmlread", - "xmlwrite", - "xslt", - "zoom", - }; -endfunction - - -%!test -%! str = unimplemented ("no_name_function"); -%! assert (isempty (str)); -%! str = unimplemented ("quad2d"); -%! assert (str(1:51), "quad2d is not implemented. Consider using dblquad."); -%! str = unimplemented ("MException"); -%! assert (str(1:58), "the 'MException' function is not yet implemented in Octave");