0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function [fails, ginfoFails] = mk_file_list(varargin)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 % A script to make a list of toolbox files and write an m-file to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % declare the files
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 % Usage: mk_file_list(toolbox_dir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % M Hewitson
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % $Id: mk_file_list.m,v 1.18 2008/12/21 18:49:25 hewitson Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 if nargin == 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 rdir = 'c:\matlab\ltpda_toolbox';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 rdir = varargin{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 if rdir(end) ~= filesep
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 rdir = [rdir filesep];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % Initialise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 nn = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 fails = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 ginfoFails = {};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 % make a list of all class methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 classes = utils.helper.ltpda_classes;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 % Go through each class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 for cls=classes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 cl = char(cls);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % get the methods for this class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 mths = methods(cl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 for m=1:numel(mths)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 mth = mths{m};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % get file name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 fi = which(fullfile(cl, mth));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 if isempty(fi)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 warning('!!! Can''t find %s/%s', cl, mth)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % Get path,name,ext
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 [path, fcnname, ext, ver] = fileparts(fi);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 % get short name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 sname = mth;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 if ~strcmpi(mth, 'contents')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 disp(sprintf('*** processing %s', mth));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 % load file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 fc = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 if ~isempty(fi)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 fd = fopen(fi, 'r');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 if fd == -1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 error('### Could not open %s', fi);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 fc = fscanf(fd, '%s');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % Look for a CVS version string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 verstr = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 ii = strfind(fc, '$Id:');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 ts = fc(ii(1):end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 ii = strfind(ts, '$');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 verstr = ts(1:ii(2));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 warning('!!! CVS Tag not found: Failed on %s', sname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 fails = [fails {sname}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 % If we have a valid version string, continue
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 ver = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 dt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 tt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 nm = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 if ~isempty(verstr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 % parse version string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 tks = regexp(verstr, 'v([.0-9]+)(\d{4}/\d{2}/\d{2})(\d{2}:\d{2}:\d{2})(\S+)', 'tokens');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 ver = tks{1}{1}; % version
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 dt = tks{1}{2}; % date
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 tt = tks{1}{3}; % time
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 ni = strfind(tks{1}{4}, 'Exp$');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 nm = tks{1}{4}(1:ni-1); % name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 ver = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 dt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 tt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 nm = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 fails = [fails {sname}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 % make hash
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 if isempty(fc)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 hs = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 hs = utils.prog.hash(fc, 'MD5');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 % Look for the category
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 cat = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 argsMin = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 argsMax = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 cmd = sprintf('ii = %s.getInfo(''%s'', ''None'');', cl, mth);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 eval(cmd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 cat = ii.mcategory;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 argsMin = num2str(ii.argsmin);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 argsMax = num2str(ii.argsmax);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 lasterr
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 % fill cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 vers(nn,1) = {fi};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 vers(nn,2) = {sname};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 vers(nn,3) = {ver};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 vers(nn,4) = {dt};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 vers(nn,5) = {tt};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 vers(nn,6) = {nm};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 vers(nn,7) = {path};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 vers(nn,8) = {hs};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 vers(nn,9) = {cat};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 vers(nn,10) = {cl};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 vers(nn,11) = {argsMin};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 vers(nn,12) = {argsMax};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 nn = nn + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 %--- Write out version file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 fname = fullfile(rdir, 'ltpda', 'm', 'etc','ltpda_versions.m');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 fd = fopen(fname, 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 fprintf(fd, 'versions = {...\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 for j=1:size(vers,1)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 fprintf(fd, '\t\t');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 for k=1:size(vers,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 fprintf(fd, '''%s''', vers{j,k});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 if k~=size(vers,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 fprintf(fd, ', ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 fprintf(fd, '; ...\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 fprintf(fd, '\t\t};\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 % Compile this to p-code
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 run(fname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 % pcode(fname, '-inplace');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 % delete(fname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 %--- Display failures
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 for j=1:length(fails)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 disp(sprintf('### FAILED: %s', fails{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 % %--- Process each file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 % for j=1:nfs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 % % This file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 % fi = tbfs{j};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 % % Get path,name,ext
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 % [path, fcnname, ext, ver] = fileparts(fi);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 % % Make exceptions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 % if ~strcmp(fcnname, 'Contents') && ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 % ~strcmp(fcnname, 'MakeContents')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180 % % get short name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 % sname = strrep(fi, rdir, '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 % if sname(1) == '/'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 % sname = sname(2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 % disp(sprintf('*** processing %s', sname));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 % % load file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 % fd = fopen(fi, 'r');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 % fc = fscanf(fd, '%s');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 % fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 % % Look for a CVS version string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 % try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 % ii = strfind(fc, '$Id:');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 % ts = fc(ii(1):end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 % ii = strfind(ts, '$');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 % verstr = ts(1:ii(2));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 % catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 % warning('!!! CVS Tag not found: Failed on %s', sname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 % fails = [fails {sname}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 % % If we have a valid version string, continue
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 % if ~isempty(verstr)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 % % parse version string
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 % tks = regexp(verstr, 'v([.0-9]+)(\d{4}/\d{2}/\d{2})(\d{2}:\d{2}:\d{2})(\S+)', 'tokens');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 % try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211 % ver = tks{1}{1}; % version
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 % dt = tks{1}{2}; % date
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 % tt = tks{1}{3}; % time
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 % ni = strfind(tks{1}{4}, 'Exp$');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 % nm = tks{1}{4}(1:ni-1); % name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216 % catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 % ver = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218 % dt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 % tt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 % nm = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 % fails = [fails {sname}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 % % make hash
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 % hs = utils.prog.hash(fc, 'MD5');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 % % get class/category
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 % idx = strfind(sname, fcnname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 % pth = sname(1:idx(end)-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 % % get class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 % if ~isempty(strfind(pth, 'classes'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 % [s,r] = strtok(pth, '@');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 % cl = r(2:end-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 % else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236 % cl = 'None';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 % % Look for the category
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 % cat = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 % acc = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 % if ismember(cl, classes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 % if ~strcmp(cl, 'None')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 % try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 % cmd = sprintf('ii = %s.getInfo(''%s'', ''None'');', cl, fcnname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 % eval(cmd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 % cat = ii.mcategory;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 % if isempty(cat)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 % ginfoFails = [ginfoFails {sname}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 % % fill cell array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 % vers(nn,1) = {fi};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 % vers(nn,2) = {fcnname};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 % vers(nn,3) = {ver};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 % vers(nn,4) = {dt};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 % vers(nn,5) = {tt};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 % vers(nn,6) = {nm};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 % vers(nn,7) = {pth};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 % vers(nn,8) = {hs};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 % vers(nn,9) = {cat};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 % vers(nn,10) = {cl};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 % nn = nn + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 % else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 % fails = [fails {sname}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 % % Only output those which are not empty
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 % vers = vers(1:nn-1,:);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 % %--- Write out version file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 % fname = [rdir '/ltpda/m/etc/ltpda_versions.m'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 % fd = fopen(fname, 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 % fprintf(fd, 'versions = {...\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 % for j=1:length(vers)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 % fprintf(fd, '\t\t');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 % for k=1:size(vers,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 % fprintf(fd, '''%s''', vers{j,k});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 % if k~=size(vers,2)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 % fprintf(fd, ', ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 % fprintf(fd, '; ...\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 % fprintf(fd, '\t\t};\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 % fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 % % Compile this to p-code
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 % run(fname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 % % pcode(fname, '-inplace');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295 % % delete(fname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 % %--- Display failures
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 % for j=1:length(fails)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 % disp(sprintf('### FAILED: %s', fails{j}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 function files = mtfilescan(root_dir, ext)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 % FILESCAN recursively scans the given directory for files that end in
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 % 'ext' and returns a list of the full paths.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 % function files = mtfilescan(root_dir, ext)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 files = getfiles(root_dir, ext, []);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314 %--------------------------------------------------------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 function ofiles = getfiles(root_dir, iext, ofiles)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 % Recursive function for getting file lists
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 disp(sprintf(' + looking in %s', root_dir));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 files = dir(root_dir);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 for j=1:length(files)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 f = files(j);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 if f.isdir
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 if strcmp(f.name,'.')==0 && strcmp(f.name,'..')==0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 %mdisp('found dir %s', f.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 ofiles = getfiles([root_dir '/' f.name], iext, ofiles);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330 [pathstr,name,ext,v] = fileparts(f.name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331 if any(strcmp(ext, iext))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 ofiles = [ofiles; cellstr([root_dir '/' f.name])];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 function mths = getMethods(cl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 mths = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 % Class info
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 % get meta info for this class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 ci = eval(sprintf('?%s', cl));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 % Get methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 ms = methods(cl); %ci.Methods;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 % Check if this is an abstract class
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 o = feval(cl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 abstract = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 abstract = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 if ~abstract
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 % Go through methods
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 for kk=1:numel(ms)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 m = eval(sprintf('?%s', ms{kk}));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 % If this is not an inherited
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361 % if strcmp(m.DefiningClass.Name, cl)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 disp(sprintf(' -- checking %s/%s', cl, m.Name));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 if strcmp(m.Access, 'public') && ~m.Static && ~strcmp(m.Name, 'Contents')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 mths = [mths; {m}];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366 % else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 % warning('!!! Skipping inherited method %s/%s', cl, m.Name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 warning('!!! Couldn''t get meta info for class %s', cl);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 % END
|