Disponible uniquement en anglais
Sysquake Pro – Table of Contents
Sysquake for LaTeX – Table of Contents
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.
In Sysquake, the Command window offers an alternate user interface which complements interactive graphics programmed with SQ files. Here are some of the tasks you can perform:
- evaluate expressions;
- store intermediate results in variables;
- call functions defined in libraries or SQ files to debug them, or simply check their syntax;
- have a quick access to online help.
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 (Option-Return on macOS)
- Line break (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:
- Simple expressions. The result is displayed unless they end with a semicolon. It is assigned automatically to variable ans (answer), which lets you reuse it in the next expression.
- Assignments to variables (new variables are created as required, and are local to the command-line interface).
- Complete loops and conditional constructs.
- Calls to user functions.
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 graphical functions are permitted. On platforms where a single graphics 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 (Option-Return on macOS).
> function r=range(x); r=max(x)-min(x); > range(1:10) ans = 9
Functions defined in the command-line interface are in the scope of library _cli:
> which range ans = _cli/range
If you import the definitions in library stat, your definition of range will be hidden:
> use stat > which range ans = stat/range
Sysquake always use the definition in the library which was imported the most recently. The order can be checked with info u:
> info u _cli stat
To let Sysquake search in _cli before stat, type use _cli:
> use _cli > info u stat _cli