Next: eigen() Up: MacAnova Help File Previous: dos_windows   Contents

edit()

Usage:
edit(obj [, T] [,stripdol:F]), obj a macro or a REAL variable
edit(0)
edit([stripdol:T])



Keywords: general
edit(obj) where obj is a REAL vector, matrix, array, or a macro, writes
a temporary file and invokes an editor to edit that file.  When editing
is done, edit() returns as value the edited contents of the file.  For
example, 'mymacro <- edit(mymacro)' allows you to change or correct
macro mymacro().  edit() is implemented as a macro which is pre-defined
only in some non-windowed versions of MacAnova.

When you change the dimensions of a vector, matrix, or array, you must
edit the header line to reflect the change before quitting the editor.

edit(obj,T) is equivalent to 'obj <- edit(obj)'.

By default, when editing a macro, trailing '$$' on temporary variables
are stripped off for editing and then restored before returning.  To
suppress this, used edit(mymacro [,T], stripdol:F)

mynewmacro <- edit([stripdol:F]) (with no non-keyword arguments) invokes
an editor on a temporary file with a header specifying a macro with a
single blank line.  You can enter and edit a macro, being sure to change
the number on line 1 to reflect the actual number of lines in the macro.
Unless stripdol:F is an argument, '$$' will be appended to any names
starting with '@'.

x <- edit(0) invokes an editor on an empty temporary file and then
performs vecread() on that file, under the assumption that the user has
edited in data that may be read in this manner.  This allows you to use
an editor to enter data.

You can specify the editor to be used by creating a CHARACTER variable
with name 'EDITOR' by, for example, EDITOR <- "emacs".  When EDITOR has
not been set, the default editor is "vi" on Unix/Linux and "edit" for
DOS.

Macro edit() is pre-defined only in the Unix/Linux non-windowed and
Motif versions and in athe extended memory DOS version of MacAnova.  Two
forms of edit(), one for Unix/Linux and one for DOS, are included with
names editunix() and editpc(), in file MacAnova.mac distributed with
MacAnova.

To edit a macro, say mymacro(), in a windowed version (Macintosh,
Windows Motif), first open a new command/output window using Open on the
File menu.  Then print it in the new window in a form you can edit by:

  Cmd> macrowrite(CONSOLE, mymacro, stripdol:T)

Then edit the macro, copy to the clipboard the entire macro including
the header line (mymacro MACRO DOLLARS) and trailer line (%mymacro%),
and then do the following:

  Cmd> mymacro <- macroread(string:CLIPBOARD)

Then switch back to your original window to test it and use it.  It's
not necessary to open the extra window, but it makes it easier since you
can separate your editing from the use of the macro.

See also topics macrowrite(), macroread(), 'CLIPBOARD'.


Gary Oehlert 2003-01-15