| 1 |
function hashTable = loadHashTable(suite) |
| 2 |
% loads a reference hash table from disk |
| 3 |
hashTable.suite = suite; |
| 4 |
hashTable.contents = struct(); |
| 5 |
filename = hashTableName(suite); |
| 6 |
if exist(filename, 'file') |
| 7 |
fid = fopen(filename, 'r'); |
| 8 |
finally_fclose_fid = onCleanup(@() fclose(fid)); |
| 9 |
|
| 10 |
data = textscan(fid, '%s : %s'); |
| 11 |
if ~isempty(data) && ~all(cellfun(@isempty, data)) |
| 12 |
functions = cellfun(@strtrim, data{1},'UniformOutput', false); |
| 13 |
hashes = cellfun(@strtrim, data{2},'UniformOutput', false); |
| 14 |
for iFunc = 1:numel(functions) |
| 15 |
hashTable.contents.(functions{iFunc}) = hashes{iFunc}; |
| 16 |
end |
| 17 |
end |
| 18 |
end |
| 19 |
end |