annotate inst/private/check_hash.m @ 231:e3f57f92fa66

Avoid just-in-time compilation when not needed * inst/private/check_hash.m: check whether the previous compilation used the same ufl file * inst/private/save_hash.m: save to disk ufl file's md5sum for future comparison * inst/private/check_oct_files.m: ensure the expected oct files are present * inst/import_ufl_*.m: add checks using the logic above
author Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
date Sat, 14 Jun 2014 15:27:43 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
231
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
1 ## Copyright (C) 2014 Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
2 ##
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
3 ## This program is free software; you can redistribute it and/or modify it under
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
4 ## the terms of the GNU General Public License as published by the Free Software
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
5 ## Foundation; either version 3 of the License, or (at your option) any later
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
6 ## version.
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
7 ##
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
11 ## details.
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
12 ##
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
13 ## You should have received a copy of the GNU General Public License along with
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
15
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
16
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
17 ## -*- texinfo -*-
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
18 ## function for internal usage only
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
19 ## @end deftypefn
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
20
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
21 function differs = check_hash (ufl_name)
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
22 if (! ischar (ufl_name))
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
23 error ("check_hash: wrong input argument");
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
24 else
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
25 filename = [ufl_name, ".ufl"];
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
26 hashfile = [filename, ".md5sum"];
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
27 [~, err, ~] = stat (hashfile);
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
28 if (err == -1)
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
29 differs = true;
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
30 else
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
31 oldhash = fileread (hashfile);
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
32 newhash = md5sum (filename);
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
33 differs = ! strcmp (oldhash, newhash);
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
34 endif
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
35 endif
e3f57f92fa66 Avoid just-in-time compilation when not needed
Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
parents:
diff changeset
36 endfunction