Category : Miscellaneous Language Source Code
Archive   : APL100.ZIP
Filename : USEFUL.HLP

 
Output of file : USEFUL.HLP contained in archive : APL100.ZIP

; Ü






USEFUL - General utility functions

Page

1 Z¢  INBUF ÿ Put characters into typeahead buffer
2 Z¢INKEY Get code of next key pressed
3 Z¢CMD ÿ Execute DOS command

For the remaining functions, read the comments included at the top.





















Z¢  INBUF ÿ - Put characters into typeahead buffer

ÿ is a scalar or vector of characters to be put into the typeahead
buffer, so that the next time I-APL requests input, these characters
will be taken from the keyboard buffer,

  must be 1, 0 or ¸1. If   is 1, characters are inserted at the
beginning of the keyboard buffer. If   is ¸1, characters are inserted
at the end of the keyboard buffer. If   is 0, the contents of ÿ
replace the contents of the keyboard buffer.

If an attempt is made to place more characters in the keyboard buffer
than there is room for, the buffer is cleared and a 0 returned,
otherwise a 1 is returned to indicate success.

Example:

ENTER¢¹AV[¹IO+13]
0 INBUF ')WSID',ENTER ½ DISPLAY WORKSPACE ID
1
)WSID ¢¢¢ This line is typed automatically
USEFUL








Z¢INKEY - Get code of next key pressed

The result of INKEY is an integer scalar code of the next key pressed.
If there is a character in the typeahead buffer, its code is returned
immediately, otherwise INKEY waits for a single key to be pressed and
then returns its code.

Some keys, eg the function keys and the cursor pad keys, return a
negative result. To discover the code for a particular key, simply
experiment.

If ESC is pressed during INKEY, 27 is returned, and no suspesion or
interrupt occurs.

















Z¢CMD ÿ - Execute DOS command

ÿ is a character scalar or vector. If ÿ is non-empty, the command in ÿ
is executed by DOS, and a 1 is returned if the command was executed,
otherwise a 0 is returned. Note that DOS will reject illegal commands
but a 1 will still be returned.

If ÿ is the empty character vector, '', I-APL will call COMMAND.COM if
there is a COMSPEC environment variable (see DOS documentation), and
the DOS prompt will be displayed. DOS commands may then be typed.
Typing EXIT returns to I-APL

Some commands cause output to be displayed, and this output is always
directed to the text screen. If the /H or /C parameter has been used,
this display will cause the graphics screen to scintillate a little,
but no harm is done. To prevent this from happening, use the > symbol
with the DOS command to re-direct output to a file, and then use the
I-APL DFILE functions to examine the result.

Example:

CMD'DEL *.BAK' ½ Delete backup files in current directory
1