view ck-oct-fcns.m @ 2983:145d5acfc68b

[project @ 1997-05-16 03:37:32 by jwe]
author jwe
date Fri, 16 May 1997 03:37:38 +0000
parents 4a9feb849125
children
line wrap: on
line source

# Script to check for dependency on whitespace_in_literal_matrix.
#
# Use with a command like this:
#
#   find . -name '*.m' -print | \
#     sed -e 's,^.*/,,' -e 's,\.m$,,' | \
#     octave --norc --silent --path "`pwd`//:" ~/check_octave_functions
#
# Originally by R. D. Auchterlounie <rda@eng.cam.ac.uk>

1;  # Don't interpret this a file that defines a single function.

function t = wlm_check (wlm, fname)
  whitespace_in_literal_matrix = wlm;
  bc = "printf (\" %s\", wlm)";
  eval (["t = type ", fname, ";"], ["t = \"failed\";", bc]);
endfunction

while (isstr (fname = fgets (stdin, 100)))

  # Someone should improve Octave's string handling capabilities!

  tmp = toascii (fname);
  tmp (length (tmp)) = 0;
  fname = setstr (tmp);

  printf ("checking %s ...", fname);

  eval (["clear ", fname]); trd = wlm_check ("traditional", fname);
  eval (["clear ", fname]); ign = wlm_check ("ignore", fname);
  eval (["clear ", fname]); def = wlm_check ("default", fname);

  if (strcmp  (trd, "failed")
      || strcmp (ign, "failed")
      || strcmp (def, "failed"))
    printf (" FAILED\n");
  else
    printf (" ok\n");
  endif

endwhile