# HG changeset patch # User Carlo de Falco # Date 1331808216 -3600 # Node ID be1f2ca7d67b00b05b4ab08480ff0b77b34a19ab # Parent 0fab7b9e622672e2f78b95f7bc167db90cfb4456 remove redundant private functions from pkg * 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 -r 0fab7b9e6226 -r be1f2ca7d67b scripts/pkg/module.mk --- a/scripts/pkg/module.mk Thu Mar 15 11:40:01 2012 +0100 +++ b/scripts/pkg/module.mk Thu Mar 15 11:43:36 2012 +0100 @@ -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 -r 0fab7b9e6226 -r be1f2ca7d67b scripts/pkg/private/fix_depends.m --- a/scripts/pkg/private/fix_depends.m Thu Mar 15 11:40:01 2012 +0100 +++ b/scripts/pkg/private/fix_depends.m Thu Mar 15 11:43:36 2012 +0100 @@ -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 -r 0fab7b9e6226 -r be1f2ca7d67b scripts/pkg/private/generate_lookfor_cache.m --- a/scripts/pkg/private/generate_lookfor_cache.m Thu Mar 15 11:40:01 2012 +0100 +++ b/scripts/pkg/private/generate_lookfor_cache.m Thu Mar 15 11:43:36 2012 +0100 @@ -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 -r 0fab7b9e6226 -r be1f2ca7d67b scripts/pkg/private/get_description.m --- a/scripts/pkg/private/get_description.m Thu Mar 15 11:40:01 2012 +0100 +++ b/scripts/pkg/private/get_description.m Thu Mar 15 11:43:36 2012 +0100 @@ -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 -r 0fab7b9e6226 -r be1f2ca7d67b scripts/pkg/private/rstrip.m --- a/scripts/pkg/private/rstrip.m Thu Mar 15 11:40:01 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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} address@hidden =} 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 -r 0fab7b9e6226 -r be1f2ca7d67b scripts/pkg/private/split_by.m --- a/scripts/pkg/private/split_by.m Thu Mar 15 11:40:01 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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} address@hidden =} 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 -r 0fab7b9e6226 -r be1f2ca7d67b scripts/pkg/private/strip.m --- a/scripts/pkg/private/strip.m Thu Mar 15 11:40:01 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -