# HG changeset patch # User Carlo de Falco # Date 1331837053 -3600 # Node ID ec7ab7e37731edd3f825ed3f64dc0e6957153304 # Parent cfb0173fe1ca85def07c822bd5b9880e36855b90 maint: Remove redundant private functions from pkg/private. * pkg/private/rstrip.m: remove file * pkg/private/strip.m: remove file * pkg/private/split_by.m: remove file * pkg/private/get_description.m: replace rstrip with deblank and strip with strtrim * pkg/private/fix_depends.m: replace rstrip with deblanak, strip with strtrim and split_by with strstrip (strsplit ()) * pkg/private/generate_llokfor_cache.m: replace split_by with strsplit (strtrim ()) diff --git a/scripts/pkg/module.mk b/scripts/pkg/module.mk --- a/scripts/pkg/module.mk +++ b/scripts/pkg/module.mk @@ -36,11 +36,8 @@ pkg/private/rebuild.m \ pkg/private/repackage.m \ pkg/private/rm_rf.m \ - pkg/private/rstrip.m \ pkg/private/save_order.m \ pkg/private/shell.m \ - pkg/private/split_by.m \ - pkg/private/strip.m \ pkg/private/uninstall.m \ pkg/private/unload_packages.m \ pkg/private/verify_directory.m \ diff --git a/scripts/pkg/private/fix_depends.m b/scripts/pkg/private/fix_depends.m --- a/scripts/pkg/private/fix_depends.m +++ b/scripts/pkg/private/fix_depends.m @@ -26,7 +26,7 @@ ## This function returns a cell of structures with the following fields: ## package, version, operator function deps_cell = fix_depends (depends) - deps = split_by (tolower (depends), ","); + deps = strtrim (strsplit (tolower (depends), ",")); deps_cell = cell (1, length (deps)); ## For each dependency. @@ -37,7 +37,7 @@ ## Does the dependency specify a version ## Example: package(>= version). if (length (lpar) == 1 && length (rpar) == 1) - package = tolower (strip (dep(1:lpar-1))); + package = tolower (strtrim (dep(1:lpar-1))); sub = dep(lpar(1)+1:rpar(1)-1); parts = strsplit (sub, " ", true); if (length (parts) != 2) @@ -54,7 +54,7 @@ ## we say that the version should be greater than ## or equal to "0.0.0". else - package = tolower (strip (dep)); + package = tolower (strtrim (dep)); operator = ">="; version = "0.0.0"; endif diff --git a/scripts/pkg/private/generate_lookfor_cache.m b/scripts/pkg/private/generate_lookfor_cache.m --- a/scripts/pkg/private/generate_lookfor_cache.m +++ b/scripts/pkg/private/generate_lookfor_cache.m @@ -23,7 +23,7 @@ ## @end deftypefn function generate_lookfor_cache (desc) - dirs = split_by (genpath (desc.dir), pathsep ()); + dirs = strtrim (strsplit (genpath (desc.dir), pathsep ())); for i = 1 : length (dirs) gen_doc_cache (fullfile (dirs{i}, "doc-cache"), dirs{i}); endfor diff --git a/scripts/pkg/private/get_description.m b/scripts/pkg/private/get_description.m --- a/scripts/pkg/private/get_description.m +++ b/scripts/pkg/private/get_description.m @@ -38,7 +38,7 @@ elseif (isspace(line(1))) ## Continuation lines if (exist ("keyword", "var") && isfield (desc, keyword)) - desc.(keyword) = cstrcat (desc.(keyword), " ", rstrip(line)); + desc.(keyword) = cstrcat (desc.(keyword), " ", deblank (line)); endif else ## Keyword/value pair @@ -47,8 +47,8 @@ disp ("skipping line"); else colon = colon(1); - keyword = tolower (strip (line(1:colon-1))); - value = strip (line (colon+1:end)); + keyword = tolower (strtrim (line(1:colon-1))); + value = strtrim (line (colon+1:end)); if (length (value) == 0) fclose (fid); error ("The keyword `%s' of the package `%s' has an empty value", diff --git a/scripts/pkg/private/rstrip.m b/scripts/pkg/private/rstrip.m deleted file mode 100644 --- a/scripts/pkg/private/rstrip.m +++ /dev/null @@ -1,37 +0,0 @@ -## Copyright (C) 2005-2012 S�ren Hauberg -## Copyright (C) 2010 VZLU Prague, a.s. -## -## 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{text} =} rstrip (@var{text}) -## Undocumented internal function. -## @end deftypefn - -## Strip the text of spaces from the right -## Example: " hello world " => " hello world" -## FIXME -- is this the same as deblank? -function text = rstrip (text) - chars = find (! isspace (text)); - if (length (chars) > 0) - ## FIXME: shouldn't it be text = text(1:chars(end)); - text = text (chars(1):end); - else - text = ""; - endif -endfunction - diff --git a/scripts/pkg/private/split_by.m b/scripts/pkg/private/split_by.m deleted file mode 100644 --- a/scripts/pkg/private/split_by.m +++ /dev/null @@ -1,30 +0,0 @@ -## Copyright (C) 2005-2012 S�ren Hauberg -## Copyright (C) 2010 VZLU Prague, a.s. -## -## 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{text} =} split_by (@var{text}, @var{sep}) -## Undocumented internal function. -## @end deftypefn - -## Split the text into a cell array of strings by sep. -## Example: "A, B" => {"A", "B"} (with sep = ",") -function out = split_by (text, sep) - out = strtrim (strsplit (text, sep)); -endfunction - diff --git a/scripts/pkg/private/strip.m b/scripts/pkg/private/strip.m deleted file mode 100644 --- a/scripts/pkg/private/strip.m +++ /dev/null @@ -1,36 +0,0 @@ -## Copyright (C) 2005-2012 S�ren Hauberg -## Copyright (C) 2010 VZLU Prague, a.s. -## -## 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} {text =} strip (@var{text}) -## Undocumented internal function. -## @end deftypefn - - -## Strip the text of spaces from the left and the right. -## Example: " hello world " => "hello world" -function text = strip (text) - chars = find (! isspace (text)); - if (length (chars) > 0) - text = text(chars(1):chars(end)); - else - text = ""; - endif -endfunction -