Interactive sessions refer to a user typing commands at the SparForte
command
prompt. AdaScript has a number of built-in commands to be used
at a command prompt. The commands behave as if they were external
commands.
cd -|dirname
change directory. "-" is the previous directory.
A leading '~' is your home directory.
Bash equivalent: cd Perl equivalent: chdir PHP equivalent: chdir
clear
Reset the display device and clear the screen, placing the cursor in the
top-left corner of the display.
Display a list of all declared identifiers, their values and their
properties, or the properties of a particular identifier.
Examples:
=> i : integer := 3
=> env i
i := 3; -- identifier of the type integer
=> c : constant string := "company"
=> env c
c := "company"; -- constant string
=> env HOME
HOME := "/home/ken"; -- imported shell environment identifier of the type string
=> env TERM
TERM := "xterm"; -- imported exported shell environment identifier of the type string
=> => env true
true := true; -- constant boolean enumerated item
=> env strings.length
; -- built-in function
=> env if
( AdaScript reserved word )
=> env ASCII.CR
ASCII.CR := '[# 13]'; -- constant character
=> env | tail -5
PWD | /home/ken/ada/bush/example | imported identifier of the type string
| s |
HOME | /home/ken | imported identifier of the type string
OLDPWD | /home/ken | identifier of the type universal_string
tail | | identifier of the type new
Display a summary of SparForte commands or show annotations (see pragma
annotate) in a script. When showing annotations, -h will show the annotations
in HTML, -m as a Linux man page and, with no options, SparForte will show the
annotations as plain text. With -l, SparForte will show the script license as
set with pragma license. With -c, the teamwork pragmas will be shown in CSV
format. With -t, the todo pragmas will be shown in CSV format and with a
work summary.
Examples:
=> help reset
reset - reopen a file
reset( file [,mode])
=> help -l bjack.sp
public_domain
=> help bjack.sp
Help for script bjack.sp:
Basic Blackjack
A basic version of the Blackjack or 21 card game
Usage: bjack
Bash equivalent: help Perl equivalent: perldoc PHP equivalent: phpdoc
Implementation Note: help -c and -t are experimental and the
output may change to improve their effectiveness.
history [n]
show the command history (up to n lines). If the number of lines is
not specified, show all the command history
Bash equivalent: jobs Perl equivalent: N/A PHP equivalent: N/A
logout
Stop an interactive, login session and leave the SparForte shell. SparForte uses a
login session if SparForte is your login shell or if you start SparForte with the
--login option. When in the debugger (breakout mode), stop debugging
and leave the SparForte shell. If the session is not a login session, an error is
displayed. Normally, return will exit SparForte. login is required for
login sessions to prevent the user from mistakenly logging themselves out if
quitting multiple shells, to let the user know they are in their top-most
shell.
Examples:
=> return
return;
^----^ warning: This is a login shell. Use logout to quit.
=> logout
When trace is true, the lines being executed are displayed, along with
additional information in parentheses, showing how SparForte interprets the commands.
The line number is displayed in square brackets after the line. The first
line is not shown which means trace, at the command prompt, always
displays "End of File" for line 2 because there is only one line to run.
trace by itself shows the current status (true or false).
Examples:
=> trace
Trace is currently off
=> trace true
Trace is on
=> "End of File" [ 2]
=> ls | wc -l
=> (shell word 'ls' expands to:)
=> (ls)
=> (exporting 'TERM=xterm')
=> (/bin/ls output attached to input end of pipe fd 7)
=> (shell word 'wc' expands to:)
=> (wc)
=> (shell word '-l' expands to:)
=> (-l)
=> (exporting 'TERM=xterm')
=> (/usr/bin/wc input attached to output end of pipe fd 6)
68
=> "End of File" [ 2]
Bash equivalent: set -x Perl equivalent: Debug::Trace PHP equivalent: xdebug
typeset var is type
Change the type of a variable, declaring it if necssary. It will attempt
to typecast the value of the variable if the variable exists: this may
raise an exception if the variable cannot be typecast. Typeset
can only be used in an interactive session (the command prompt). It cannot
be used with pragma ada_95.
Examples:
=> y := 5.5
=> (Assuming y is a new universal_numeric variable)
=> env y
y := 5.50000000000000E+00; -- identifier of the type universal_numeric
=> typeset y is float
=> env y
y := 5.50000000000000E+00; -- identifier of the type float
=> typeset y is integer
=> env y
y := 6; -- identifier of the type integer
Permanently delete an identifier. Keywords cannot be unset. Unset can only
be used in an interactive session (the command prompt). It cannot be used with
pragma ada_95.
Examples:
=> i : integer
=> unset i
=> ? i
? i;
^ i not declared