Command-Line Interface

This chapter describes the command-line interface, where you can type expressions and commands expressed in LME, the language of SysQuake, and observe the results immediately.

The main purpose of SysQuake is interactive graphics. However, it is often convenient to issue simple commands at a command-line interface. This permits evaluation of expressions, checking command syntax and behavior as well as debugging user functions. For these reasons, SysQuake also includes this possibility.

You can type commands, cut to or paste from the clipboard after the prompt, and copy from anywhere. When you hit the Return key, everything after the last prompt is interpreted. The following keys have a special meaning:

Return
Interprets everything from the last prompt.
Shift-Return
Carriage return (e.g. for i=1:10<shift-return> i<shift-return> end<return> to display the integer numbers from 1 to 10)
Esc
Clears the current command.
Up
Retrieves the previous command.
Down
Retrieves the next command.

Commands you can type in the Command window or panel include:

The commands you can type are described in the chapter LME Reference (LME is the name of the language used by SysQuake). You can also type expressions; LME evaluates them and displays their result unless you add a semicolon. When you evaluate an expression, its result is assigned to the variable ans, so that you can reuse it easily. Here is a simple example which displays four times the sine of three radians, and then adds 5 to the result (type what is in bold; the plain characters correspond to what SysQuake displays itself when you hit the Return key):

> 4*sin(3)
 ans =
  0.5645
> ans+5
 ans =
  5.5645

Calls to graphic functions are permitted. On platforms where a single graphic window is displayed, if an SQ file is already loaded, you can clear the figures first with the clf command:

> clf
> plot(sin(0:0.1:2*pi))

Functions and constants are usually defined in SQ files or libraries. You can also do it directly in the command-line interface:

> define g = 9.81;
> t = 3;
> g * t^2
 ans =
  88.29

You must type the whole definition before evaluating it with the Return key. Separate the statements either with semicolons or with Shift-Return.

> function v=var(x); v=sum((x-mean(x)).^2);
> var(1:10)
 ans =
  82.5

Functions defined in the command-line interface are in the scope of library _cli:

> which var
 ans =
  _cli/var

If you import the definitions in library stat, your definition of var will be hidden:

> use stat
> which var
 ans =
  stat/var

SysQuake always use the definition in the library which was imported the most recently. The order can be checked with info u:

> info u
  (base)
  _cli
  stat

To let SysQuake search in _cli before stat, type use _cli:

> use _cli
> info u
  (base)
  stat
  _cli

Copyright 1998-2001, Calerga.

All rights reserved.