Go to the previous, next section.
limits
is defined to mean LIMITS x y
. It is also possible to read
Mongo files using the READ OLD
command, and the macros
input
and read_old
based upon it. The following list
of enhancements in not complete; See the distribution notes from the
current release of SM.
Enhancements:
Any number of vectors may be defined. Vectors may be manipulated arithmetically. Vectors are named. Vectors may be defined from the keyboard usingDO
loops or expressions. Vectors may be defined using the cursor. Any vector may be used for plotting. Any vector may be used for thePTYPE
orERRORBAR
commands. A history feature is implemented. The playback buffer may be edited. Macros may be defined from the keyboard, and edited. ADO
construct is available. AFOREACH
construct is available. Character strings may be read from a file and used freely as labels or names. Data may be read from rows as well as columns in files. Only those parts of a vector satisfying a logical condition need be plotted. Vectors may be sorted or fit with splines. Macros exist for doing least square fit to sets of points,constructing cumulative distributions and histograms, drawing circles, and shading regions. All devices have the same range of device coordinates, 0-32767. The entire SM environment may be saved for later resumption withSAVE
andRESTORE
. The special variable$date
expands to the current date and time. You can define private point types.
There are also a few incompatibilities:
DEFINE
is used to define variables; macros are defined usingMACRO
. Macro arguments must be declared, and are referred to as$n
, not&n
. The formLIMITS
is not supported (it's meaningless); useLIMITS x y
, or the macrolim
, mentioned above. (But note thatREAD OLD
allows for these, and makes suitable changes.)WINDOW
now takes 4 arguments.
READ OLD
reads a Mongo file, converts its contents to a form
acceptable to SM, and defines them as a macro.
Any macro definition (i.e. from a line beginning def
to
a line beginning end
) is converted to the SM form (i.e.
`$s' not `&s') and defined. The commands CONNECT,
HISTOGRAM, LIMITS, and POINTS are converted to LIMITS x y, and so
forth. ERRORBAR, ECOLUMN, and WINDOWS are also converted. READ OLD
will fail if the Mongo file contains abbreviations such as xc for XCOLUMN,
then your only hope is to define the same abbreviations. In many cases this
will have already been done, for instance xc
expands to read x
.
Comments (beginning !) are optionally converted to standard
SM
# comments (depending on how the file `read_old.c' was compiled.)
Note that it is advisable to convert these old Mongo macro files to SM macros, to enable you to take advantage of SM's features. You can do this by simply using READ OLD to read them into SM, and then MACRO WRITE or SAVE to write the converted macro out to disk.
There is also a macro equivalent of the old INPUT
command.
input 1 ## read and execute a Mongo (not SM) file READ OLD _temp $1 _temp MACRO _temp DELETE
This version of compatibility is more complete than in pre-version 2 SM, it also conflicts more strongly with normal SM operations.
The macro compatibility
defines mimics for the Mongo commands
which assume that the only vectors are x
and y
. We
strongly recommend that you do not use this macro! If you want
to use it anyway, commands like limits alpha beta
will give
syntax errors. You can turn compatibility mode off again with compatibility 0
. The macro itself is a little complicated, it turns
off the special meaning of (e.g.) limits
, and replaces it with a
macro that reproduces the old behaviour, in this case LIMITS x
y
. The new definitions are in the file `compatible' in the
default macro directory, as specified in your `.sm' file. At
the time of writing, the commands connect
, errorbar
, histogram
, limits
, list
, points
, read
, and
window
are redefined to reproduce the old syntax. In addition,
help
is defined to not appear on your history buffer, and define
is defined to create macros interactively. You might also be
interested in other redefinitions of commands (e.g. list
to mean
list the playback buffer), if so look at `overloading' in the index.
It should be clear
that this set of definitions could thoroughly confuse SM if
you try to take advantage of its features; in the realm of
compatibility mode, it is strictly caveat emptor.
compatible 11 ## define macros to be compatible with Mongo # If the argument is non-zero or omitted, # compatibility mode is turned on. # note that some of these make it hard to use regular SM! if($?1 == 0) { compatible 1 RETURN } if($1 == 0) { MACRO DELETE "$!macro"compatible } FOREACH w { connect define errorbar help histogram limits \ list points read window write 2 { OVERLOAD $w $1 } if($1) { MACRO READ "$!macro"compatible } # So newline will end IF statement
Go to the previous, next section.