annotate _chordtools/checklabsyntax.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 %
matthiasm@8 2 % CHECKLABSYNTAX Check the syntax of all chords in a lab file
matthiasm@8 3 %
matthiasm@8 4 % [success] = checklabsyntax(labfile, {fid})
matthiasm@8 5 %
matthiasm@8 6 % Checks syntax of all chord symbols in a lab file. Any incorrect chords
matthiasm@8 7 % will produce syntax errors and be quoted with time of chord from the
matthiasm@8 8 % labfile given for inspection.
matthiasm@8 9 %
matthiasm@8 10 % fid is the file id of the output log file. If not given, the error log
matthiasm@8 11 % will be printed to the screen
matthiasm@8 12 %
matthiasm@8 13 % Success = 1 if all symbols have correct syntax, 0 otherwise.
matthiasm@8 14 %
matthiasm@8 15 % Returns: success (boolean)
matthiasm@8 16 %
matthiasm@8 17 %
matthiasm@8 18 % Author: Christopher Harte, August 2005
matthiasm@8 19 %
matthiasm@8 20 % Copyright: Centre for Digital Music, Queen Mary University of London 2005
matthiasm@8 21 %
matthiasm@8 22 % This file is part of the C4DM Chord Toolkit.
matthiasm@8 23 %
matthiasm@8 24 % The C4DM Chord Toolkit is free software; you can redistribute it and/or
matthiasm@8 25 % modify it under the terms of the GNU General Public License as published
matthiasm@8 26 % by the Free Software Foundation; either version 2 of the License, or
matthiasm@8 27 % (at your option) any later version.
matthiasm@8 28 %
matthiasm@8 29 % The C4DM Chord Toolkit is distributed in the hope that it will be useful,
matthiasm@8 30 % but WITHOUT ANY WARRANTY; without even the implied warranty of
matthiasm@8 31 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
matthiasm@8 32 % GNU General Public License for more details.
matthiasm@8 33 %
matthiasm@8 34 % You should have received a copy of the GNU General Public License
matthiasm@8 35 % along with the C4DM Toolkit; if not, write to the Free Software
matthiasm@8 36 % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
matthiasm@8 37
matthiasm@8 38 %
matthiasm@8 39 function [success] = checklabsyntax(labfile,fid)
matthiasm@8 40
matthiasm@8 41 if nargin < 2
matthiasm@8 42 fid = 1;
matthiasm@8 43 end
matthiasm@8 44
matthiasm@8 45 success = 1;
matthiasm@8 46
matthiasm@8 47 [times1,t2,symbols] = labread(labfile);
matthiasm@8 48
matthiasm@8 49 ilength = length(symbols);
matthiasm@8 50
matthiasm@8 51 % new file
matthiasm@8 52 fprintf(fid, ['*** File: ' labfile ' ***\n\n']);
matthiasm@8 53
matthiasm@8 54 errormessage = '';
matthiasm@8 55
matthiasm@8 56 for index = 1:ilength
matthiasm@8 57
matthiasm@8 58 [ok, errormessage] = syntaxcheck(char(symbols(index)));
matthiasm@8 59
matthiasm@8 60
matthiasm@8 61 if ok == 0
matthiasm@8 62
matthiasm@8 63 success = 0;
matthiasm@8 64
matthiasm@8 65 fprintf(fid,['Time: %f seconds\n' errormessage '\n\n'], times1(index));
matthiasm@8 66
matthiasm@8 67 end
matthiasm@8 68 end
matthiasm@8 69
matthiasm@8 70