# HG changeset patch # User Rik # Date 1377023518 25200 # Node ID 5ff843d739fc0743e7f1bed42902bd828e246b1c # Parent e351b499311eefcaeab718d8eee76b24211d4385 Add new desktop.m function to Octave (bug #37330). * scripts/miscellaneous/desktop.m: new m-file. * scripts/miscellaneous/module.mk: Add desktop.m to build system. *NEWS: Add desktop to list of new functions for 3.8. Re-organized new features of 3.8. diff -r e351b499311e -r 5ff843d739fc NEWS --- a/NEWS Tue Aug 20 11:07:53 2013 -0700 +++ b/NEWS Tue Aug 20 11:31:58 2013 -0700 @@ -43,29 +43,28 @@ endfunction endfunction - ** 'emptymatch', 'noemptymatch' options added to regular expressions. + ** Line continuations inside character strings have changed. - With this addition Octave now accepts the entire set of Matlab options - for regular expressions. 'noemptymatch' is the default, but 'emptymatch' - has certain uses where you need to match an assertion rather than actual - characters. For example, - - regexprep ('World', '^', 'Hello ', 'emptymatch') - => Hello World - - where the pattern is actually the assertion '^' or start-of-line. + The sequence '...' is no longer recognized as a line continuation + inside a character string. A backslash '\' followed by a newline + character is no longer recognized as a line continuation inside + single-quoted character strings. Inside double-quoted character + strings, a backslash followed by a newline character is still + recognized as a line continuation, but the backslash character must + be followed *immediately* by the newline character. No whitespace or + end-of-line comment may appear between them. - ** For compatibility with Matlab, the regexp, regexpi, and regexprep - functions now process backslash escape sequences in single-quoted pattern - strings. In addition, the regexprep function now processes backslash - escapes in single-quoted replacement strings. For example, - - regexprep (str, '\t', '\n') + ** Backslash as a continuation marker outside of double-quoted strings + is now deprecated. - would search the variable str for a TAB character (escape sequence \t) - and replace it with a NEWLINE (escape sequence \n). Previously the - expression would have searched for a literal '\' followed by 't' and - replaced the two characters with the sequence '\', 'n'. + Using '\' as a continuation marker outside of double quoted strings + is now deprecated and will be removed from a future version of + Octave. When that is done, the behavior of + + (a \ + b) + + will be consistent with other binary operators. ** Redundant terminal comma accepted by parser @@ -77,29 +76,6 @@ c,... ] = deal (1,2,3) - ** Line continuations inside character strings have changed. - - The sequence '...' is no longer recognized as a line continuations - are inside character strings. A backslash followed by a newline - character is no longer recognized as a line continuation inside - single-quoted character strings. Inside double-quoted character - strings, a backslash followed by a newline character is still - recognized as a line continuation but the backslash character must - be followed immediately by the newline character. No whitespace or - end-of-linecomment may appear between them. - - ** Backslash as a continuation marker outside of double-quoted strings - is now deprecated. - - Using '\' as a continuation marker outside fo double quoted strings - is now deprecated and will be removed from a future version of - Octave. When that is done, the behavior of - - (a \ - b) - - will be consistent with other binary operators. - ** Octave now has limited support for named exceptions The following syntax is now accepted: @@ -128,6 +104,30 @@ Octave:array-as-scalar => Octave:array-to-scalar Octave:array-as-vector => Octave:array-to-vector + ** 'emptymatch', 'noemptymatch' options added to regular expressions. + + With this addition Octave now accepts the entire set of Matlab options + for regular expressions. 'noemptymatch' is the default, but 'emptymatch' + has certain uses where you need to match an assertion rather than actual + characters. For example, + + regexprep ('World', '^', 'Hello ', 'emptymatch') + => Hello World + + where the pattern is actually the assertion '^' or start-of-line. + + ** For compatibility with Matlab, the regexp, regexpi, and regexprep + functions now process backslash escape sequences in single-quoted pattern + strings. In addition, the regexprep function now processes backslash + escapes in single-quoted replacement strings. For example, + + regexprep (str, '\t', '\n') + + would search the variable str for a TAB character (escape sequence \t) + and replace it with a NEWLINE (escape sequence \n). Previously the + expression would have searched for a literal '\' followed by 't' and + replaced the two characters with the sequence '\', 'n'. + ** The m-files in the image directory have been overhauled. The principal benefit is that Octave will now no longer automatically @@ -142,8 +142,8 @@ with imread instead of a RGB image if the colormap was not requested as output. - ** The colormap function now provides new options--"list", "register", - and "unregister"--to list all available colormap functions, and to + ** The colormap function now provides new options---"list", "register", + and "unregister"---to list all available colormap functions, and to add or remove a function name from the list of known colormap functions. Packages that implement extra colormaps should use these commands with PKG_ADD and PKG_DEL statements. @@ -196,6 +196,11 @@ In addition two new error functions erfi (imaginary error function) and dawson (scaled imaginary error function) have been added. + ** The glpk function has been modified to reflect changes in the GLPK + library. The "round" and "itcnt" options have been removed. The + "relax" option has been replaced by the "rtest" option. The numeric + values of error codes and of some options have also changed. + ** The default name of the Octave crash dump file is now called octave-workspace instead of octave-core. @@ -222,11 +227,6 @@ helpdlg listdlg questdlg inputdlg msgbox warndlg - ** The glpk function has been modified to reflect changes in the GLPK - library. The "round" and "itcnt" options have been removed. The - "relax" option has been replaced by the "rtest" option. The numeric - values of error codes and of some options have also changed. - ** Other new functions added in 3.8.0: atan2d erfi jit_startcnt @@ -241,10 +241,12 @@ dawson imformats shrinkfaces dblist importdata splinefit debug_jit isaxes stemleaf - doc_cache_create iscolormap strjoin - ellipj isequaln struct2hdl - ellipke jit_debug tetramesh - erfcinv jit_enable waterfall + desktop iscolormap strjoin + doc_cache_create isequaln struct2hdl + ellipj jit_debug tetramesh + ellipke jit_enable waterfall + erfcinv + ** Deprecated functions. @@ -286,7 +288,7 @@ The internal class has been deprecated in Octave 3.8 and will be removed from Octave 3.12 (or whatever version is the second major release after 3.8). Replacement classes are (struct array) - or for single structure. + or for a single structure. Summary of important user-visible changes for version 3.6: --------------------------------------------------------- diff -r e351b499311e -r 5ff843d739fc scripts/miscellaneous/desktop.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/miscellaneous/desktop.m Tue Aug 20 11:31:58 2013 -0700 @@ -0,0 +1,50 @@ +## Copyright (C) 2013 John W. Eaton +## +## 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 +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {} @var{used} = desktop ("-inuse") +## Return true if the desktop (GUI) is currently in use. +## @seealso{isguirunning} +## @end deftypefn + +function retval = desktop (arg) + + if (nargin == 0) + if (isguirunning ()) + return; # desktop() is a NOP when GUI running + else + print_usage (); + endif + elseif (nargin > 1) + error ('desktop: only one argument, "-inuse", is allowed'); + endif + + switch (tolower (arg)) + case "-inuse" + retval = isguirunning (); + otherwise + print_usage (); + endswitch + +endfunction + + +## Test input validation +%!error desktop (1,2) +%!error desktop ("-invalid_option") + diff -r e351b499311e -r 5ff843d739fc scripts/miscellaneous/module.mk --- a/scripts/miscellaneous/module.mk Tue Aug 20 11:07:53 2013 -0700 +++ b/scripts/miscellaneous/module.mk Tue Aug 20 11:31:58 2013 -0700 @@ -18,6 +18,7 @@ miscellaneous/copyfile.m \ miscellaneous/debug.m \ miscellaneous/delete.m \ + miscellaneous/desktop.m \ miscellaneous/dir.m \ miscellaneous/dos.m \ miscellaneous/dump_prefs.m \