[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test, string and special matrix funcs

From: John W. Eaton
Subject: Re: test, string and special matrix funcs
Date: Fri, 5 May 2000 02:50:55 -0500 (CDT)

On  3-May-2000, Paul Kienzle <address@hidden> wrote:

| I'm a little worried about dumping all those idle test scripts into my
| running octave process.  Octave does not strip comments when it loads
| the function.  

Actually, current versions of Octave discard all comments except the
help text.  However, my current sources do save the comment text in
the parse tree so that Octave can do things like reproduce and
possibly pretty-print the function (currently implemented with the
type -t command) or translate it to C++ or some other language (maybe
someday, anyway).

| Perhaps we should leave tests in .test files where they
| only takes up disk space?  Or maybe octave should leave off comments
| which start '%!'? (Okay, so the total size of all scripts combined in
| 2.1.28 only takes up 1.4 Mb, and the whole of the test tree a mere 95k,
| so not such an issue).

Right, I don't think it is a very large amount of text to save.  Also,
Octave only loads the M-files that are actually needed.  Most people
will never use all the M-files in one session, so the total amount of
memory required to save the comments is much less than the total of

Another source of bloat is the Texinfo help text that was recently
moved into the C++ source files.  But even then, in a statically
linked Octave binary, the help text amounts to less than 250k.

If saving the extra text ever does become a real problem, it should be
possible to teach Octave to only save the comments if it needs them,
and to save look up the help text from an external file (as GNU Emacs
does for its doc strings).  But I don't think it is worth worrying
about until someone can demonstrate a real problem.

| Note, this is how to check for 'missing' commas:
|       whitespace_in_literal_matrix="ignore"
| Do it before you load in the function, though!

With the current sources (in the CVS archive, at least) Octave will
print a warning when it encounters a situation where the value of
whitespace_in_literal_matrix can cause different results.  So Now it
is almost sufficient to simply run something like

  for f in `find . -name '*.m'`
    ( echo "warn_separator_insert = 1;"; cat $f ) | octave -qf

in the scripts directory and see if it prints the warning (you
actually want to do something that will run only over the function
files, not the scripts, or Octave needs a --parse-only option).

This is only almost sufficient because this doesn't account for the
possibility of using eval to evaluate a string that is constructed at

| I would like to see exist('name','var') added as well, though I haven't
| tested this particular patch.  For compatibility if for no other reason.

Yes, it would be nice for exist to not be unnecessarily incompatible.

| And I have to admit, having separate functions for doing the same
| thing is starting to get on my nerves.  'tolower' vs. 'lower' for example.
| One of them is "cruft", but I'm not sure which.

Matlab has lower.  Octave has tolower, because it is that name in the
C library that those functions (isascii, isgraph, tolower, toupper
etc.) are patterned after.  For compatability, Octave also has lower.


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]