2335
|
1 # Script to check for dependency on whitespace_in_literal_matrix. |
|
2 # |
|
3 # Use with a command like this: |
|
4 # |
|
5 # find . -name '*.m' -print | \ |
|
6 # sed -e 's,^.*/,,' -e 's,\.m$,,' | \ |
|
7 # octave --norc --silent --path "`pwd`//:" ~/check_octave_functions |
|
8 # |
|
9 # Originally by R. D. Auchterlounie <rda@eng.cam.ac.uk> |
|
10 |
|
11 1; # Don't interpret this a file that defines a single function. |
|
12 |
|
13 function t = wlm_check (wlm, fname) |
|
14 whitespace_in_literal_matrix = wlm; |
|
15 bc = "printf (\" %s\", wlm)"; |
|
16 eval (["t = type ", fname, ";"], ["t = \"failed\";", bc]); |
|
17 endfunction |
|
18 |
|
19 while (isstr (fname = fgets (stdin, 100))) |
|
20 |
|
21 # Someone should improve Octave's string handling capabilities! |
|
22 |
|
23 tmp = toascii (fname); |
|
24 tmp (length (tmp)) = 0; |
|
25 fname = setstr (tmp); |
|
26 |
|
27 printf ("checking %s ...", fname); |
|
28 |
|
29 eval (["clear ", fname]); trd = wlm_check ("traditional", fname); |
|
30 eval (["clear ", fname]); ign = wlm_check ("ignore", fname); |
|
31 eval (["clear ", fname]); def = wlm_check ("default", fname); |
|
32 |
|
33 if (strcmp (trd, "failed") |
|
34 || strcmp (ign, "failed") |
|
35 || strcmp (def, "failed")) |
|
36 printf (" FAILED\n"); |
|
37 else |
|
38 printf (" ok\n"); |
|
39 endif |
|
40 |
|
41 endwhile |