view ck-oct-fcns.m @ 4337:d56e0d75e7c9 ss-2-1-45

[project @ 2003-02-19 21:20:19 by jwe]
author jwe
date Wed, 19 Feb 2003 21:20:19 +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