To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / _chordtools / checklabs.m @ 8:b5b38998ef3b
History | View | Annotate | Download (1.52 KB)
| 1 |
% |
|---|---|
| 2 |
% CHECKLABS check chord syntax in all lab files in a directory |
| 3 |
% |
| 4 |
% success = checklabs(directory, logfile) |
| 5 |
% |
| 6 |
% Check the syntax of chord symbols in every lab file in the target |
| 7 |
% directory. A log of syntax errors is created in the text file logfile |
| 8 |
% |
| 9 |
% Success = 1 if all symbols have correct syntax, 0 otherwise. |
| 10 |
% |
| 11 |
% returns: success (boolean) |
| 12 |
% |
| 13 |
% |
| 14 |
% Author: Christopher Harte, August 2005 |
| 15 |
% |
| 16 |
% Copyright: Centre for Digital Music, Queen Mary University of London 2005 |
| 17 |
% |
| 18 |
% This file is part of the C4DM Chord Toolkit. |
| 19 |
% |
| 20 |
% The C4DM Chord Toolkit is free software; you can redistribute it and/or |
| 21 |
% modify it under the terms of the GNU General Public License as published |
| 22 |
% by the Free Software Foundation; either version 2 of the License, or |
| 23 |
% (at your option) any later version. |
| 24 |
% |
| 25 |
% The C4DM Chord Toolkit is distributed in the hope that it will be useful, |
| 26 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 |
% GNU General Public License for more details. |
| 29 |
% |
| 30 |
% You should have received a copy of the GNU General Public License |
| 31 |
% along with the C4DM Toolkit; if not, write to the Free Software |
| 32 |
% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 33 |
|
| 34 |
% |
| 35 |
function [success] = checklabs(directory, logfile) |
| 36 |
|
| 37 |
olddir = cd; |
| 38 |
|
| 39 |
cd(directory); |
| 40 |
|
| 41 |
files = dir('*.lab');
|
| 42 |
|
| 43 |
ilength = length(files); |
| 44 |
|
| 45 |
success = 1; |
| 46 |
|
| 47 |
fid = fopen(logfile, 'a'); |
| 48 |
|
| 49 |
for index = 1:ilength |
| 50 |
|
| 51 |
ok = checklabsyntax(files(index).name,fid); |
| 52 |
|
| 53 |
success = success && ok; |
| 54 |
|
| 55 |
end |
| 56 |
|
| 57 |
fclose(fid); |
| 58 |
|