Dylibs isdylib.m: Difference between revisions
Jump to navigation
Jump to search
(initial edit) |
(add source highlighting) |
||
Line 1: | Line 1: | ||
An m-file function used in support of [[Create_a_MacOS_X_App_Bundle_Using_MacPorts|creating a MacOS X App bundle]]. | An m-file function used in support of [[Create_a_MacOS_X_App_Bundle_Using_MacPorts|creating a MacOS X App bundle]]. | ||
< | <source lang="octave">## Copyright (C) 2012 Ben Abbott | ||
## | ## | ||
## This program is free software; you can redistribute it and/or modify | ## This program is free software; you can redistribute it and/or modify | ||
Line 27: | Line 27: | ||
## @end deftypefn | ## @end deftypefn | ||
## Author: Ben Abbott <bpabbott@ | ## Author: Ben Abbott <bpabbott@mac.com> | ||
## Created: 2012-06-29 | ## Created: 2012-06-29 | ||
Line 42: | Line 42: | ||
result = result | fun (cstr); | result = result | fun (cstr); | ||
endfor | endfor | ||
endfunction</ | endfunction</source> |
Latest revision as of 20:54, 7 January 2013
An m-file function used in support of creating a MacOS X App bundle.
## Copyright (C) 2012 Ben Abbott
##
## This program 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.
##
## This program 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
## <http://www.gnu.org/licenses/>.
## -*- texinfo -*-
## @deftypefn {Function File} result = dylibs_isdylib (@var{filename})
## Determines if the filename qualifies as a dynamically loaded library.
## The @var{result} is @var{true} for dylib-files, oct-files, and mex-files.
## The result is @var{false} for all other files.
##
## This function isn't sophisticated. It only examines the file extension.
## @seealso {dylibs__find, dylibs_get_deps, dylibs_fix}
## @end deftypefn
## Author: Ben Abbott <bpabbott@mac.com>
## Created: 2012-06-29
function result = dylibs_isdylib (cstr)
persistent flip=@(str)str(end:-1:1)
if (ischar (cstr))
cstr = {cstr};
endif
suffix = {".dylib", ".oct", ".mex"};
result = false (size (cstr));
for n = 1:numel(suffix)
fun = @(str) strncmp (cellfun (flip, str, "UniformOutput", false),
flip (suffix{n}), numel (suffix{n}));
result = result | fun (cstr);
endfor
endfunction