| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9. Interactive mode
Interactive mode is entered by executing the command asy with
no file arguments. When the -multiline option is disabled (the default),
each line must be a complete Asymptote statement (unless
explicitly continued by a final backslash character \);
it is not necessary to terminate input lines with a semicolon.
If one assigns settings.multiline=true, interactive code can be
entered over multiple lines; in this mode, the automatic termination of
interactive input lines by a semicolon is inhibited. Multiline mode is useful
for cutting and pasting Asymptote code directly into the
interactive input buffer.
Interactive mode can be conveniently used as a calculator: expressions
entered at the interactive prompt (for which a corresponding write
function exists) are automatically evaluated and written to stdout.
The following special commands are supported only in interactive mode and must be entered immediately after the prompt:
-
help view the manual;
-
reset reset the
Asymptoteenvironment to its initial state, except for changes to the settings module (see settings), the current directory (see cd), and breakpoints (see section Debugger);-
input FILE does an interactive reset, followed by the command
include FILE. If the file nameFILEcontains nonalphanumeric characters, enclose it with quotation marks. A trailing semi-colon followed by optionalAsymptotecommands may be entered on the same line.-
quit exit interactive mode (
exitis a synonym; the abbreviationqis also accepted unless there exists a top-level variable namedq). A history of the most recent 1000 (this number can be changed with thehistorylinesconfiguration variable) previous commands will be retained in the file.asy/historyin the user's home directory (unless the command-line option-localhistorywas specified, in which case the history will be stored in the file.asy_historyin the current directory).
Typing ctrl-C interrupts the execution of Asymptote code
and returns control to the interactive prompt.
Interactive mode is implemented with the GNU readline library,
with command history and auto-completion. To customize the key bindings, see:
http://cnswww.cns.cwru.edu/php/chet/readline/readline.html
The file asymptote.py in the Asymptote system directory
provides an alternative way of entering Asymptote commands
interactively, coupled with the full power of Python. Copy this
file to your Python path and then execute from within
Python the commands
from asymptote import *
g=asy()
g.size(200)
g.draw("unitcircle")
g.send("draw(unitsquare)")
g.fill("unitsquare, blue")
g.clip("unitcircle")
g.label("\"$O$\", (0,0), SW")
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
