GetInp


Introduction

Beside the normal commands used in this program, there is a group of extra commands available. With these commands simple scripting facilities, startup scripts, aliases and other useful options are available.

All these commands have to be prefixed with a backslash (\). This prefix character can be changed with the \prefix command.

This is how a command is presented in this manual.
Aliases are case insensitive and are always stored in uppercase.
Lines starting with ! are treated as comments.


Commands by type

Aliases
\alias define or list aliases
\dir directory listing
\evaluate calculator
\export put alias to environment
\import import alias from environment
\repeat multiple execution
\shell create new shell
\store save result from evaluate
\unalias remove alias
 
Directories
\back return to previous directory
\cd change working directory
\dir directory listing
\mkdir create directory
 
Files
@ execute commandfile
& execute commandfile
\command show command list
\dir directory listing
\edit invoke editor
\journal copy input commands to file
\rename rename file
 
Flow Control
\exit emulate end-of-file
\goto skip statements
\if conditional execution
\repeat multiple execution
 
Keyboard
@ execute commandfile
& execute commandfile
\bell keyboard bell
\help try to display program help
\journal write input commands to file
\pause pause until user types go
 
Process
\spawn execute command as subshell
\shell create new shell
 
Screen
\cls clear screen
\echo echo input commands and command files
\output more or less output
\wl set terminal width to 132
\wn set terminal width to 80
 
Timing
\cpu show cpu time since last setcpu
\date show date
\pause wait for user (if interactive)
\second show cpu time since last setcpu
\setcpu initialize cpu timer
\time show time
\wait wait

Commands

@

Syntax: @filename
Open a command file and read until end-of-file.

&

Syntax: &filename
Check a command file and read until end-of-file.
If filename exist, run the command @filename, otherwise nothing happens.

\alias

Define or list aliases. Actions are dependent of the number of parameters.
Syntax:
\alias list all aliases
\alias a list specific alias a
\alias a line set alias a to line
See substitutions for the substitution rules.

\back

return to the previous directory. See \cd.

\bell

Ring keyboard bell.

\cd

Syntax: \cd new-directory-name
Change working directory
See \back. The alias WORK_DIR contains the directoryname where the program was started from, so you may return to this directory with \cd WORK_DIR.

\cls

Clear screen

\command

Display the contents of file CONFIG_PATH/IMAGE_NAME.commands (if this file exists).

\cpu

Show cpu time used (in hh:mm:ss) since last \setcpu. See also \second.

\date

Show current date

\dir

Syntax: \dir [name]
Get a directory listing.
The number of files will be stored in the alias DIRCOUNT.

\echo

Set/reset echo of input commands.
Syntax: \echo on/off/auto/debug
\echo onecho all input commands
\echo offdo not echo input commands
\echo autoecho input commands only from @files
\echo debugecho all input commands. Echo cannot be switched off anymore

\edit

Invoke the default editor.
Syntax: \edit filename

\evaluate

Syntax: \evaluate expression
Evaluate an expression.
Evaluate always stores the result in the alias EVAL_RESULT. (use \store to save the result into another alias.)
Expressions
+ add
- subtract
* multiply
/ divide
** power
^ power
Functions (radians)
tan tangent
sin sine
cos cosine
atan arc tangent
asin arc sine
acos arc cosine
Functions (degrees)
tand tangent
sind sine
cosd cosine
atand arc tangent
asind arc sine
acosd arc cosine
Other Functions
sqrt square root
exp exponent
log natural log
log10 base 10 log
int truncate
nint round
Constants
Pi 3.1415....
PiOver2 0.5*Pi
TwoPi 2*Pi
Grad 180.0/Pi

\exit

emulate an end-of-file
If this command is executed from a script (@file), the rest of the file is ignored. If you type \exit from the keyboard, you will probably end the program

\export

Syntax: \export aliasname
Define environment variable with the same name as an alias.
This is only useful if you are going to create new processes (via \shell or \spawn).

\goto

Syntax: \goto label
Skip statements
All input is skipped until a line with !label is encountered. Notes:

\help

Try to display program help
Syntax: \help [text]
The program will search for an URL with information. The search order is:
  1. Environment variable IMAGE_NAME
  2. CONFIG_PATH/IMAGE_NAME.html
  3. CONFIG_PATH/doc/index.html
  4. CONFIG_PATH/doc/IMAGE_NAME.html
If the subdirectory doc does not exist, the search will be tried for subdirectory html.
If you specify the optional [text] the search order will be
  1. Environment variable IMAGE_NAME
  2. CONFIG_PATH/IMAGE_NAME.html
  3. CONFIG_PATH/doc/commands.html
  4. CONFIG_PATH/doc/IMAGE_NAME_commands.html
  5. CONFIG_PATH/doc/IMAGE_NAME.html
If the URL is found, a html browser (firefox, mozilla, netscape) will be launched with the URL as option. First the program tries to launche a daughter of a running browser (with options -remote and new-window). If this fails, the browser will be started. You may define the browser with the environment variable BROWSER or with an alias BROWSER.

If the URL is not found, a search is done for a (VMS-like) .hlp file. The search order is:

  1. CONFIG_PATH/doc/IMAGE_NAME.hlp
  2. CONFIG_PATH/IMAGE_NAME.hlp
If found, the program will allow you to browse this hlp file.

\if

Execute commands depending on a condition.
or negate with the statement \if not

\import

Syntax: \import variable
Get the value of a environment variable.
The value is stored in an alias with the same name as variable

\journal

Syntax: \journal on/off/suspend
Echo input commands to a journal file.

\mkdir

Syntax: \mkdir directory-name
Create a new directory

\output

Syntax: \output none/normal/full/debug
Default: \output normal
Selects less or more output.
OutputLevel Command Action
full @ echo script name
\command list obsolete commands
\alias echo alias definition
\repeat echo repeat nr and command
\unalias echo removal of alias
debug   a lot during file search
  echo input and substituted lines

\pause

Wait until the user enters the command go. Pause is only activated if the process mode is interactive. You may use this command in a @script to suspend execution.

\prefix

Syntax: \prefix c
Set the prefix character to c. The default is a backslash (\).

\repeat

Syntax: \repeat n line
Repeat a command
n is the number of lines to repeat the command line. If NREP is an existing alias, the value of NREP will be incremented each time line is executed.

\rename

Syntax: \rename oldfile newfile
Rename a file.

\second

Show cpu time (in seconds) used since last \setcpu. See also \cpu.

\setcpu

Initialize cpu timer. You can use \cpu or \second to show the used cpu time.

\shell

Create a new shell. The program will be suspended. If you terminate the shell (control-d) the program will be activated.

\spawn

Syntax: \spawn command
Start a subprocess and execute command.

\status

Show the status of all internal commands.

\store

Syntax: \store aliasname
Save the result of \evaluate into an alias.
\evaluate always stores the result in the alias EVAL_RESULT, and the contents of this alias are copied into the alias you specify.

\time

Show current time.

\unalias

Undefine aliases. Actions depend on the parameters.

\wait

Syntax: \wait f
Delay the execution of the program. where f is the time in seconds.

\wl

Set terminal with to 132
Use \wn to set the width to 80.

\wn

Set terminal width to 80
Use \wl to set the width to 132.

Alias substitution

The alias substitution rules: Examples:
Before With Alias Without Alias
abcd [abcd] abcd
ab'cd ab[cd] abcd
'abcd [abcd] abcd
ab''cd   ab'cd
''abcd   'abcd
ab'c'd ab[c]d abcd
'ab'cd [ab]cd abcd
abcd'   abcd

Startup

Some aliases are created at the startup of the program.
alias value
CONFIG_PATH path where image configuration files reside
IMAGE_NAME name of current image
USER_NAME user invoking the program
WORK_DIR directory where program was started from
NODE_NAME host name
PROCESS_MODE Batch, Interactive.....
PROCESS_NAME process name or process id

At program startup 3 init files (if they exist) will be executed if the following order:

  1. CONFIG_PATH/IMAGE_NAME.init
  2. CONFIG_PATH/IMAGE_NAME.initlocal
  3. IMAGE_NAME.init in the current directory

Example

This is how a .init file could look like:
#make an alias script1 which executes a file
\alias script1 @'config_path'script1

#if script2 exists, make an alias script2
\if file 'config_path'script2 \alias script2 @'config_path'script2
#so script2 will be an unknown command if the file does not exist

#another approach:
\alias script2 &'config_path'script2
#so script2 will be defined, but does nothing if the file does not exist.

\alias x 600
\alias y 400
\alias w 1000
\alias h 800
\alias zoom2 zoomfactor 2 zoom 'hx'-'w'/4  'hy'-'h'/4  'hx'+'w'/4  'hy'+'h'/4
\alias zoom3 zoomfactor 3 zoom 'hx'-'w'/6  'hy'-'h'/6  'hx'+'w'/6  'hy'+'h'/6
\alias zoom4 zoomfactor 4 zoom 'hx'-'w'/8  'hy'-'h'/8  'hx'+'w'/8  'hy'+'h'/8
\alias zoom5 zoomfactor 5 zoom 'hx'-'w'/10 'hy'-'h'/10 'hx'+'w'/10 'hy'+'h'/10
\unalias w \unalias h \unalias x \unalias y

#go5 will run go 5 times
\alias go5 \repeat 5 go