annotate scripts/miscellaneous/private/__xzip__.m @ 14868:5d3a684236b0

maint: Use Octave coding conventions for cuddling parentheses in scripts directory * lin2mu.m, loadaudio.m, wavread.m, accumarray.m, bicubic.m, celldisp.m, colon.m, cplxpair.m, dblquad.m, divergence.m, genvarname.m, gradient.m, int2str.m, interp1.m, interp1q.m, interp2.m, interpn.m, loadobj.m, nthargout.m, __isequal__.m, __splinen__.m, quadgk.m, quadl.m, quadv.m, rat.m, rot90.m, rotdim.m, saveobj.m, subsindex.m, triplequad.m, delaunay3.m, griddata.m, inpolygon.m, tsearchn.m, voronoi.m, get_first_help_sentence.m, which.m, gray2ind.m, pink.m, dlmwrite.m, strread.m, textread.m, textscan.m, housh.m, ishermitian.m, issymmetric.m, krylov.m, logm.m, null.m, rref.m, compare_versions.m, copyfile.m, dump_prefs.m, edit.m, fileparts.m, getappdata.m, isappdata.m, movefile.m, orderfields.m, parseparams.m, __xzip__.m, rmappdata.m, setappdata.m, swapbytes.m, unpack.m, ver.m, fminbnd.m, fminunc.m, fsolve.m, glpk.m, lsqnonneg.m, qp.m, sqp.m, configure_make.m, copy_files.m, describe.m, get_description.m, get_forge_pkg.m, install.m, installed_packages.m, is_architecture_dependent.m, load_package_dirs.m, print_package_description.m, rebuild.m, repackage.m, save_order.m, shell.m, allchild.m, ancestor.m, area.m, axes.m, axis.m, clabel.m, close.m, colorbar.m, comet.m, comet3.m, contour.m, cylinder.m, ezmesh.m, ezsurf.m, findobj.m, fplot.m, hist.m, isocolors.m, isonormals.m, isosurface.m, isprop.m, legend.m, mesh.m, meshz.m, pareto.m, pcolor.m, peaks.m, plot3.m, plotmatrix.m, plotyy.m, polar.m, print.m, __add_datasource__.m, __add_default_menu__.m, __axes_limits__.m, __bar__.m, __clabel__.m, __contour__.m, __errcomm__.m, __errplot__.m, __ezplot__.m, __file_filter__.m, __fltk_print__.m, __ghostscript__.m, __gnuplot_print__.m, __go_draw_axes__.m, __go_draw_figure__.m, __interp_cube__.m, __marching_cube__.m, __patch__.m, __pie__.m, __plt__.m, __print_parse_opts__.m, __quiver__.m, __scatter__.m, __stem__.m, __tight_eps_bbox__.m, __uigetdir_fltk__.m, __uigetfile_fltk__.m, __uiputfile_fltk__.m, quiver.m, quiver3.m, rectangle.m, refreshdata.m, ribbon.m, scatter.m, semilogy.m, shading.m, slice.m, subplot.m, surface.m, surfl.m, surfnorm.m, text.m, uigetfile.m, uiputfile.m, whitebg.m, deconv.m, mkpp.m, pchip.m, polyaffine.m, polyder.m, polygcd.m, polyout.m, polyval.m, ppint.m, ppjumps.m, ppval.m, residue.m, roots.m, spline.m, splinefit.m, addpref.m, getpref.m, setpref.m, ismember.m, setxor.m, arch_fit.m, arch_rnd.m, arch_test.m, autoreg_matrix.m, diffpara.m, fftconv.m, filter2.m, hanning.m, hurst.m, periodogram.m, triangle_sw.m, sinc.m, spectral_xdf.m, spencer.m, stft.m, synthesis.m, unwrap.m, yulewalker.m, bicgstab.m, gmres.m, pcg.m, pcr.m, __sprand_impl__.m, speye.m, spfun.m, sprandn.m, spstats.m, svds.m, treelayout.m, treeplot.m, bessel.m, factor.m, legendre.m, perms.m, primes.m, magic.m, toeplitz.m, corr.m, cov.m, mean.m, median.m, mode.m, qqplot.m, quantile.m, ranks.m, zscore.m, logistic_regression_likelihood.m, bartlett_test.m, chisquare_test_homogeneity.m, chisquare_test_independence.m, kolmogorov_smirnov_test.m, run_test.m, u_test.m, wilcoxon_test.m, z_test.m, z_test_2.m, bin2dec.m, dec2base.m, mat2str.m, strcat.m, strchr.m, strjust.m, strtok.m, substr.m, untabify.m, assert.m, demo.m, example.m, fail.m, speed.m, test.m, now.m: Use Octave coding conventions for cuddling parentheses in scripts directory.
author Rik <octave@nomad.inbox5.com>
date Tue, 17 Jul 2012 07:08:39 -0700
parents 72c96de7a403
children e7f6c479ce1c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 13952
diff changeset
1 ## Copyright (C) 2008-2012 Thorsten Meyer
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
2 ## based on the original gzip function by David Bateman
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
3 ##
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
4 ## This file is part of Octave.
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
5 ##
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
9 ## your option) any later version.
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
10 ##
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
14 ## General Public License for more details.
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
15 ##
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
18 ## <http://www.gnu.org/licenses/>.
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
19
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
20 ## -*- texinfo -*-
8812
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8443
diff changeset
21 ## @deftypefn {Function File} {@var{entries} =} __xzip__ (@var{commandname}, @var{extension}, @var{commandtemplate}, @var{files}, @var{outdir})
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8443
diff changeset
22 ## Undocumented internal function.
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8443
diff changeset
23 ## @end deftypefn
7d48766c21a5 use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents: 8443
diff changeset
24
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
25 ## Compress the list of files and/or directories specified in @var{files}
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
26 ## with the external compression command @var{commandname}. The template
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
27 ## @var{commandtemplate} is used to actually start the command. Each file
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
28 ## is compressed separately and a new file with the extension @var{extension}
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
29 ## is created and placed into the directory @var{outdir}. The original files
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
30 ## are not touched. Existing compressed files are silently overwritten.
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
31 ## This is an internal function. Do not use directly.
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
32
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
33 function entries = __xzip__ (commandname, extension,
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
34 commandtemplate, files, outdir)
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
35
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
36 if (nargin != 4 && nargin != 5)
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
37 print_usage ();
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
38 endif
13141
e81ddf9cacd5 maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 12958
diff changeset
39
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
40 if (! ischar (extension) || length (extension) == 0)
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
41 error ("__xzip__: EXTENSION must be a string with finite length");
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
42 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
43
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
44 if (nargin == 5 && ! exist (outdir, "dir"))
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
45 error ("__xzip__: OUTDIR output directory does not exist");
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
46 endif
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
47
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
48 if (ischar (files))
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
49 files = cellstr (files);
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
50 endif
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
51 if (! iscellstr (files))
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
52 error ("__xzip__: FILES must be a character array or cellstr");
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
53 endif
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
54
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
55 if (nargin == 4)
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
56 outdir = tmpnam ();
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
57 mkdir (outdir);
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
58 endif
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
59
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
60 cwd = pwd ();
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
61 unwind_protect
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
62 files = glob (files);
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
63
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
64 ## Ignore any file with the compress extension
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
65 files(cellfun (@(x) length (x) > length (extension)
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
66 && strcmp (x((end - length (extension) + 1):end), extension),
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
67 files)) = [];
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
68
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
69 copyfile (files, outdir);
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
70
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
71 [d, f] = myfileparts (files);
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
72
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
73 cd (outdir);
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
74
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
75 cmd = sprintf (commandtemplate, sprintf (" %s", f{:}));
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
76
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
77 [status, output] = system (cmd);
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
78 if (status)
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
79 error ("__xzip__: %s command failed with exit status = %d",
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
80 commandname, status);
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
81 endif
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
82
12953
5cc3b7673d25 __xzip__: Fix regression about moving compressed files (bug #33993)
Orion Poplawski <orion@cora.nwra.com>
parents: 12499
diff changeset
83 if (nargin == 5)
5cc3b7673d25 __xzip__: Fix regression about moving compressed files (bug #33993)
Orion Poplawski <orion@cora.nwra.com>
parents: 12499
diff changeset
84 if (nargout > 0)
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
85 entries = cellfun(
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
86 @(x) fullfile (outdir, sprintf ("%s.%s", x, extension)),
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
87 f, "uniformoutput", false);
12953
5cc3b7673d25 __xzip__: Fix regression about moving compressed files (bug #33993)
Orion Poplawski <orion@cora.nwra.com>
parents: 12499
diff changeset
88 endif
5cc3b7673d25 __xzip__: Fix regression about moving compressed files (bug #33993)
Orion Poplawski <orion@cora.nwra.com>
parents: 12499
diff changeset
89 else
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
90 movefile (cellfun (@(x) sprintf ("%s.%s", x, extension), f,
12953
5cc3b7673d25 __xzip__: Fix regression about moving compressed files (bug #33993)
Orion Poplawski <orion@cora.nwra.com>
parents: 12499
diff changeset
91 "uniformoutput", false), cwd);
5cc3b7673d25 __xzip__: Fix regression about moving compressed files (bug #33993)
Orion Poplawski <orion@cora.nwra.com>
parents: 12499
diff changeset
92 if (nargout > 0)
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
93 ## FIXME this does not work when you try to compress directories
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
94 entries = cellfun (@(x) sprintf ("%s.%s", x, extension),
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
95 files, "uniformoutput", false);
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
96 endif
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
97 endif
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
98
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
99 unwind_protect_cleanup
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
100 cd (cwd);
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
101 if (nargin == 4)
13952
acaf33ccc04f Use "local" option to configuration variables to simplify code.
Rik <octave@nomad.inbox5.com>
parents: 13141
diff changeset
102 confirm_recursive_rmdir (false, "local");
acaf33ccc04f Use "local" option to configuration variables to simplify code.
Rik <octave@nomad.inbox5.com>
parents: 13141
diff changeset
103 rmdir (outdir, "s");
12499
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
104 endif
a3019189ac51 Improve file archiving functions (gzip, bzip2, zip, unpack)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
105 end_unwind_protect
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
106
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
107 endfunction
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
108
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
109 function [d, f] = myfileparts (files)
12931
cefd568ea073 Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents: 12499
diff changeset
110 [d, f, ext] = cellfun ("fileparts", files, "uniformoutput", false);
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
111 f = cellfun (@(x, y) sprintf ("%s%s", x, y), f, ext,
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
112 "uniformoutput", false);
12931
cefd568ea073 Replace function handles with function names in cellfun calls for 15% speedup.
Rik <octave@nomad.inbox5.com>
parents: 12499
diff changeset
113 idx = cellfun ("isdir", files);
8349
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
114 d(idx) = "";
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
115 f(idx) = files(idx);
02beb5be5683 add bzip2 function
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
diff changeset
116 endfunction
8443
34c0acf11539 Fix error messages in __xzip__
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 8362
diff changeset
117
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
118 ## FIXME -- reinstate these tests if we invent a way to test private
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
119 ## functions directly.
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
120 ##
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
121 ## %!error <extension has to be a string with finite length>
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
122 ## %! __xzip__ ("gzip", "", "gzip -r %s", "bla");
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
123 ## %!error <no files to move>
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
124 ## %! __xzip__ ("gzip", ".gz", "gzip -r %s", tmpnam);
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
125 ## %!error <command failed with exit status>
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
126 ## %! # test __xzip__ with invalid compression command
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
127 ## %! unwind_protect
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
128 ## %! filename = tmpnam;
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
129 ## %! dummy = 1;
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
130 ## %! save (filename, "dummy");
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
131 ## %! dirname = tmpnam;
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
132 ## %! mkdir (dirname);
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
133 ## %! entry = __xzip__ ("gzip", ".gz", "xxxzipxxx -r %s 2>/dev/null",
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
134 ## %! filename, dirname);
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
135 ## %! unwind_protect_cleanup
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
136 ## %! delete (filename);
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
137 ## %! rmdir (dirname);
9899
9f25290a35e8 more private function and subfunction changes
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
138 ## %! end_unwind_protect