Mercurial > hg > ishara
changeset 7:47cb292350f3
Some documentation fixes.
author | samer |
---|---|
date | Mon, 14 Jan 2013 14:52:38 +0000 |
parents | 0ce3c2070089 |
children | f0a3d7d7a0e3 |
files | general/algo/gatherer.m general/cellutils/cellmap.m general/cellutils/cellzip.m general/fileutils/frecurse.m general/fileutils/listfiles.m general/fileutils/md5file.m general/getparam.m general/sh.m general/tostring.m |
diffstat | 9 files changed, 27 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/general/algo/gatherer.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/algo/gatherer.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,4 +1,18 @@ % gatherer - API for autoexpanding arrays for accumulating data +% +% gatherer :: +% [N,M]:[[1,2]] ~'size of elements to gather', +% options { +% init :: natural/512 ~'initial size of buffer'; +% grow :: natural/2 ~'factor by which to auto-expand buffer'; +% max :: natural/1e9 ~'maximum size of buffer' +% } +% -> struct { +% remove :: natural => void ~'action to remove last n elements'; +% length :: void => natural ~'action to return current buffer length'; +% append :: [[N,M]] => void ~'action to append data to buffer'; +% collect :: void =>[[N,L]] ~'action to return buffer contents and reset'; +% }. function api=gatherer(size_in,varargin) opts=prefs('chunk',256,'init',512,'grow',2,'max',1e9,varargin{:}); n=uint32(0);
--- a/general/cellutils/cellmap.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/cellutils/cellmap.m Mon Jan 14 14:52:38 2013 +0000 @@ -6,5 +6,5 @@ % preallocate to fix size Y=cell(size(X)); for i=1:numel(X) - Y{i}=feval(fn,X{i}); + Y{i}=fn(X{i}); end
--- a/general/cellutils/cellzip.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/cellutils/cellzip.m Mon Jan 14 14:52:38 2013 +0000 @@ -17,7 +17,7 @@ for i=1:prod(sz) args=cellmap(@(c)c{i},varargin); - Y{i}=feval(fn,args{:}); + Y{i}=fn(args{:}); end
--- a/general/fileutils/frecurse.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/fileutils/frecurse.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,13 +1,13 @@ function frecurse(fn,dirname,level) -% recurse: recursively descend a directory tree +% frecurse: recursively descend a directory tree % -% recurse :: +% frecurse :: % (string ~'directory name',natural~'level'=>bool~'descend into?') ~'fn to process directory, % string ~'directory to start from, % natural ~'initial level assigned to start directory' % => void. % -% usage: recurse(<function>,<dirname>[,<level0>]) +% usage: frecurse(<function>,<dirname>[,<level0>]) % % traverses directory tree, starting at <dirname>, % and calling the named <function> for each directory.
--- a/general/fileutils/listfiles.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/fileutils/listfiles.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,7 +1,8 @@ function L=listfiles(dirname,varargin) % listfiles - list files in a directory % -% listfiles :: text ~'directory path', +% listfiles :: +% text ~'directory path', % options { % 'pattern':text ~'pattern to match files against', % 'regext':text ~'regular expression to match files against',
--- a/general/fileutils/md5file.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/fileutils/md5file.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,3 +1,5 @@ +% md5file - Use md5sum to compute md5 hash +% md5file :: string ~'filename' -> string ~'hash'. function hash=md5file(fn) [rc,result]=system(sprintf('md5sum -b "%s"',fn)); if rc==0
--- a/general/getparam.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/getparam.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,7 +1,7 @@ function a=getparam(s,field,def) % getparam - get value of named field or default if not present % -% getparam :: struct Fields, string, A -> A. +% getparam :: struct Fields, string~'field name', A~'default value' -> A. % % Typical usage is with structures returned by prefs.
--- a/general/sh.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/sh.m Mon Jan 14 14:52:38 2013 +0000 @@ -1,3 +1,2 @@ % sh - drop out to Unix shell -function sh -unix('bash'); +function sh, unix('bash'); end
--- a/general/tostring.m Mon Jan 14 14:33:37 2013 +0000 +++ b/general/tostring.m Mon Jan 14 14:52:38 2013 +0000 @@ -7,6 +7,7 @@ % % Multiple inputs are converted to comma-separated string. s=cat_sep(',',map(@tostr,varargin)); +end function s=tostr(x) if ischar(x), s=x; @@ -19,4 +20,5 @@ elseif isa(x,'func'), s=tostring(x); else s=['obj:' class(x)]; end +end