* Bug 16665 fixed: help('echo') can redirect to help('mode') on preferences 22/21722/6
Samuel GOUGEON [Fri, 2 Apr 2021 21:01:07 +0000 (23:01 +0200)]
  http://bugzilla.scilab.org/16665

  Interactive test:
  // Preference unchecked (default):
  help echo  // => list of possible matching pages displayed on the left
  preferences
      // General/Documentation : check "Redirect Matlab terms to closest Scilab equivalent"
      // validate and quit
  help echo  // => display the mode() page
  help cot   // => display the cotg() page. etc

Change-Id: I5129c130592fefb99180eb44d8abe245a00db7c0

scilab/CHANGES.md
scilab/modules/console/etc/XConfiguration-general.xml
scilab/modules/console/etc/XConfiguration-general.xsl
scilab/modules/demo_tools/macros/demo_gui.sci
scilab/modules/helptools/data/external2scilab_equiv.csv [new file with mode: 0644]
scilab/modules/helptools/macros/help.sci

index 3bbcefe..33ef5e9 100644 (file)
@@ -264,6 +264,7 @@ User Interface improvements
   - The menu "Issues" allows to display bugzilla entries related to the feature of the current page
   - ATOMS chapters are automatically loaded in the browser.
   - The page left at exit is restored at next startup.
+  - On Preferences option, querring some Matlab term can now redirect and display the documentation of the Scilab equivalent feature.
 * `x_matrix` can now edit matrices of booleans, integers, or text. Matrices of real or complex numbers are better displayed.
 
 
@@ -411,7 +412,6 @@ Bug Fixes
 * [#16458](https://bugzilla.scilab.org/16458): `mean()` did not handle sparse numerical matrices.
 * [#16465](https://bugzilla.scilab.org/16465): Scinotes OpenRecent menu was not updated when it should.
 * [#16473](https://bugzilla.scilab.org/16473): Deleting rows in a sparse squared the matrix with padding zeros (Scilab 6 regression).
-<<<<<<< HEAD
 * [#16474](https://bugzilla.scilab.org/16474): `imult(%z)` crashed Scilab.
 * [#16476](https://bugzilla.scilab.org/16476): `issquare` was not overloaded.
 * [#16488](https://bugzilla.scilab.org/16488): Concatenations mixing boolean and double with at least one operand being sparse were not supported.
@@ -422,13 +422,13 @@ Bug Fixes
 * [#16517](https://bugzilla.scilab.org/16517): `getdate("s")` truncated the actual time to integer seconds. `getdate(u)(10)` returned fractional seconds instead of milliseconds as `getdate()`.
 * [#16522](https://bugzilla.scilab.org/16522): `bitget(x,pos)` and `bitset(x,pos)` results could be wrong when `pos` is an encoded integer.
 * [#16525](https://bugzilla.scilab.org/16525): `soundsec(t,freq)` has the trivial equivalence `0 : 1/freq : t*(1-%eps)` and should be removed.
+* [#16529](https://bugzilla.scilab.org/16529): `deff` could not return the created function as output argument, preventing to cretae and use anonymous functions. The function's headline and body had to be provided separately. For Simple functions, a one-string input (possibly console-oriented) definition was not supported.
 * [#16530](https://bugzilla.scilab.org/16530): `mapsound` needed to be reforged.
 * [#16549](https://bugzilla.scilab.org/16549): simple script crashed Scilab in GUI mode.
 * [#16551](https://bugzilla.scilab.org/16551): `num2cell` returned {} for any input array of empty strings.
 * [#16552](https://bugzilla.scilab.org/16552): `mfile2sci`: conversion of `ispc` and `isunix` still used `MSDOS` removed far ago. Conversion of `ismac` was missing. Conversion of `exist` missed using `mtlb_exist`. Conversion of `dos` yielded some "operation +" warnings. Unit tests for the conversion of `cd`, `dir` and `ferror` overwrote some Scilab reserved keywords. Conversion of `return` yielded `mtlb(resume)`.
 * [#16553](https://bugzilla.scilab.org/16553): `unique(["" ""])` returned `["" ""]`.
 * [#16557](https://bugzilla.scilab.org/16557): `macr2tree` + `tree2code` translated `e={2}` into `"e=1"` and `e={2,"ab"}` into `"e=[2,"ab"]"`.
-<<<<<<< HEAD
 * [#16559](https://bugzilla.scilab.org/16553): `isempty(A)` was true for sparse matrix of dimension 2^16 or larger.
 * [#16561](https://bugzilla.scilab.org/16561): `histplot(-10:0.2:10, 2)` yielded a warning from `histc` and an error.
 * [#16565](https://bugzilla.scilab.org/16565): `edit(user_defined_function)` corrupted the original code.
@@ -458,13 +458,8 @@ Bug Fixes
 * [#16639](https://bugzilla.scilab.org/16639): `atomsInstall` and `atomsRemove` did not update the Toolboxes menu.
 * [#16644](https://bugzilla.scilab.org/16644): `input("message:")` yielded a wrong error message about `mprintf` in case of non-interpretable input.
 * [#16654](https://bugzilla.scilab.org/16654): `interp` was leaking memory.
+* [#16665](https://bugzilla.scilab.org/16665): `help echo` could not redirect to `help mode` when preferred, for new users coming from Octave.
 
-=======
->>>>>>> afb92ac5368 (* Bug 16614 fixed: replot() could fail out of gcf())
-=======
-* [#16529](https://bugzilla.scilab.org/16529): `deff` could not return the created function as output argument, preventing to cretae and use anonymous functions. The function's headline and body had to be provided separately. For Simple functions, a one-string input (possibly console-oriented) definition was not supported.
-
->>>>>>> 75a0ccd0638 (* Bug 16529 fixed: deff() upgraded: output arg added, one-string def, etc)
 
 ### Bugs fixed in 6.1.0:
 * [#2694](https://bugzilla.scilab.org/2694): `bitget` did not accept positive integers of types int8, int16 or int32.
index fd8a732..ae4912b 100644 (file)
             </actions>
         </body>
     </shortcuts>
-    <demonstrations title="_(Demos)">
+    <documentation title="_(Help and demos)">
       <body>
         <demos demoGUIisDockable="checked"/>
+        <help redirectMatlab2Scilab="unchecked"/>
       </body>
-    </demonstrations>
+    </documentation>
 </general>
index 6896a2e..e3b0f7b 100644 (file)
             </Grid>
         </Title>
     </xsl:template>
+    <xsl:template match="help">
+        <Title text="help()">
+            <Grid>
+                <Checkbox
+                      gridx="1"
+                      gridy="2"
+                      listener="ActionListener"
+                      checked="{@redirectMatlab2Scilab}"
+                      text="_(Redirect Matlab terms to Scilab closest equivalent)"
+                      >
+                    <actionPerformed choose="redirectMatlab2Scilab">
+                        <xsl:call-template name="context"/>
+                    </actionPerformed>
+                </Checkbox>
+            </Grid>
+        </Title>
+    </xsl:template>
+
 </xsl:stylesheet>
index 0e65bc7..380a9fa 100644 (file)
@@ -48,7 +48,7 @@ function demo_gui()
     // =========================================================================
     // We get the user Preferences for the GUI: dockable / not dockable
     File = SCIHOME + "/XConfiguration.xml";
-    r = xmlGetValues("//general/demonstrations/body/demos","demoGUIisDockable", File);
+    r = xmlGetValues("//general/documentation/body/demos","demoGUIisDockable", File);
 
     // We tune accordingly the predefined demo GUI
     File = SCI + "/modules/demo_tools/gui/demo_gui.xml";
diff --git a/scilab/modules/helptools/data/external2scilab_equiv.csv b/scilab/modules/helptools/data/external2scilab_equiv.csv
new file mode 100644 (file)
index 0000000..10562a8
--- /dev/null
@@ -0,0 +1,257 @@
+all;and;
+angle;atan;
+any;or;
+argv;sciargs;// Octave
+arrayfun;feval;
+atan2;atan;
+axes;newaxes;
+axis;replot;
+balance;balanc;
+bicg;conjgrad;
+bicgstab;conjgrad;
+blkdiag;blockdiag;
+box;gca;
+caxis;colorbar;
+celldisp;disp;
+cgs;conjgrad;
+charpoly;poly;
+chebwin;window;
+cla;delete;
+class;typeof;
+clear global;clearglobal;
+closereq;xdel;
+colormap;jetcolormap;
+columns;size;// Octave
+commandhistory;browsehistory;
+compan;companion;
+completion_matches;completion;// Octave
+computer;getos;
+contains;grep;
+contourc;contour2di;
+contour3;contour;
+cot;cotg;
+copyobj;copy;
+cputime;timer;
+csvread;csvRead;
+dbclear;debug;
+dbcont;resume;
+dbquit;abort;
+dbstack;where;
+dbstatus;debug;
+dbstop;debug;
+dbup;return;
+deal;brackets;
+deblank;stripblanks;
+demo;demo_gui;
+dlmwrite;fprintfMat;
+echo;mode;
+eig;eigs;
+ellipj;amell;
+ellipke;percentk;
+endsWith;grep;
+eps;percenteps;
+erase;strsubst;
+errorbar;errbar;
+errordlg;messagebox;
+exist;exists;
+extractAfter;regexp;
+extractBefore;regexp;
+false;percentf;
+fclose;mclose;
+feof;meof;
+fftn;fft;
+fgetl;mgetl;
+fgets;mgetl;
+fill;xfpolys;
+flintmax;number_properties;
+flip;flipdim;
+flipud;flipdim;
+fliplr;flipdim;
+fopen;mopen;
+fplot;plot;
+fputs;mputstr;// Octave
+fread;mget;
+frewind;mseek;
+func2str;macr2tree;
+fwrite;mput;
+fzero;fsolve;
+gallery;testmatrix;
+gammainc;cdfgam;
+get_home_directory;home;// Octave
+getpref;xmlGetValues;
+ginput;locate;
+grid;xgrid;
+gtext;legends;
+help;uman;// Octave
+helpdlg;messagebox;
+helpwin;help;
+hggroup;glue;
+hgload;load;
+hgsave;save;
+hist;histplot;
+histcounts;histc;
+hold;axes_properties;
+housh;householder;// Octave
+horzcat;cat;
+i;percenti;
+ifft2;ifft;
+ifftn;ifft;
+image;Matplot;
+imagesc;Matplot1;
+index;strindex;// Octave
+inf;percentinf;
+int2str;string;
+intmin;int8;
+intmax;int8;
+invfeqz;frfit;
+is_absolute_filename;is_absolute_path;// Octave
+isa;m2sci_isa;
+isalnum;isalphanum;// Octave
+iscell;typeof;
+iscellstr;typeof;
+isfolder;isdir;
+isgraphics;is_handle_valid;// Octave
+isguirunning;getscilabmode;// Octave
+ishghandle;is_handle_valid;
+isinteger;type;
+isjava;typeof;
+iskeyword;getscilabkeywords;
+ismac;getos;
+ismember;members;
+ispc;getos;
+isunix;getos;
+is_valid_file_id;file;// Octave
+j;percenti;
+join;strcat;
+kaiser;window;
+keyboard;pause;
+listdlg;x_choose;
+loglog;plot;
+lookfor;apropos;
+lower;convstr;
+lstat;fileinfo;// Octave
+magic;testmatrix;
+mat2str;sci2exp;
+matlabroot;SCI;
+msgbox;messagebox;
+mfilename;get_absolute_file_path;
+mod;pmodulo;
+more;lines;
+nan;percentnan;
+nanmin;min;
+nanmax;max;
+nargin;argn;
+nargout;argn;
+newline;ascii;
+nonzeros;spget;
+num2str;string;
+numel;size;
+OCTAVE_HOME;SCIHOME;// Octave
+ode23;ode;
+ode45;ode;
+ode113;ode;
+ode15s;ode;
+odeget;odeoptions;
+openvar;editvar;
+paddarray;resize_matrix;
+patch;xfpolys;
+pcg;conjgrad;
+pi;percentpi;
+pkg;atoms;// Octave
+planerot;givens;
+plot3;param3d;
+plottools;ged;
+polar;polarplot;
+polyarea;polygonmetrics;
+polyder;derivat;
+polygcd;gcd;// Octave
+polyval;horner;
+prctile;perctl;
+printdlg;toprint;
+psi;dlgamma;
+puts;mprintf;
+questdlg;messagebox;
+quiver;champ;
+rande;grand;// Octave
+randg;grand;
+randi;grand;
+randn;rand;
+randp;grand;// Octave
+randperm;grand;
+range;strange;
+residue;pfss;
+rbbox;rubberbox;
+realmax;number_properties;
+realmin;number_properties;
+regexprep;strsubst;
+rem;modulo;
+replace;strsubst;
+reshape;matrix;
+reverse;strrev;
+rmfield;null;
+rot90;flipdim;
+rows;size;// Octave
+run;exec;
+semilogx;plot;
+semilogy;plot;
+shg;show_window;
+skrewness;cmoment;// Octave
+sort;gsort;
+sortrows;gsort;
+source;exec;// Octave
+spalloc;spzeros;
+spdiags;diag;
+splitlines;strsplit;
+sprandn;sprand;
+sprandsym;sprand;
+spy;PlotSparse;
+stairs;plot2d2;
+startsWith;grep;
+stat;fileinfo;// Octave
+std;stdev;
+stdin;percentio;// Octave
+stdout;percentio;// Octave
+stderr;percentio;// Octave
+stem;plot2d3;
+str2func;execstr;
+strfind;strindex;
+strings;emptystr;
+strjoin;strcat;
+strjust;justify;
+strlength;length;
+strread;msscanf;
+strrep;strsubst;
+strtrim;stripblanks;
+strtrunc;strncpy;// Octave
+surf2patch;genfac3d;
+switch;select;
+tempdir;TMPDIR;
+terminal_size;lines;// Octave
+texlabel;math_rendering_features_in_graphic;
+text;xstring;
+textscan;msprintf;
+time;getdate;// Octave
+tolower;convstr;// Octave
+toupper;convstr;// Octave
+trapz;inttrap;
+true;percentt;
+tukeywin;window;
+typeinfo;typeof;// Octave
+uisetcolor;uigetcolor;
+uitable;uicontrol;
+unix;unix_g;
+upper;convstr;
+urlread;getURL;
+var;variance;
+version;getversion;
+vertcat;cat;
+waitforbuttonpress;xclick;
+warndlg;messagebox;
+webread;getURL;
+which;get_function_path;
+whos -file;listvarinfile;
+xlim;axes_properties;
+ylim;axes_properties;
+yyaxis;newaxes;
+zlim;axes_properties;
+zoom;zoom_rect;
index c5fbc07..961ab1d 100644 (file)
@@ -1,7 +1,7 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2008 - INRIA - Vincent COUVERT
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
-// Copyright (C) 2020 - Samuel GOUGEON
+// Copyright (C) 2020 - 2021 - Samuel GOUGEON
 //
 // This file is hereby licensed under the terms of the GNU GPL v2.0,
 // pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -53,8 +53,27 @@ function help(varargin)
     if part(key,1)=="$" & (exists(key)==0 | length(key)==1) then
         key = "symbols";
     end
+    // Possible key redirection to Scilab's closest equivalent
+    key = helpRedirectExternal2Scilab(key)
+
     // Calling the browser
     helpbrowser(%helps(:,1), key, lang, %f);
     // If the key is not a xml:id, then full-text search is done (See Java code)
 
 endfunction
+
+// ============================================================================
+
+function sciterm = helpRedirectExternal2Scilab(exterm)
+    sciterm = exterm
+    filename = SCIHOME + filesep() + "XConfiguration.xml"
+    res = xmlGetValues("//general/documentation/body/help", "redirectMatlab2Scilab", filename);
+    if res=="checked" then
+        filename = SCI + "/modules/helptools/data/external2scilab_equiv.csv"
+        tmp = csvRead(filename,";",[],"string",[]);
+        k = find(tmp(:,1)==exterm)
+        if k <> []
+            sciterm = tmp(k(1),2)
+        end
+    end
+endfunction