3.05 Consoles

Console Overview

A console is basically a text only window or device. It may be capable of supporting multiple fonts, multiple colours, highlighting and other variations, or it may have none of these capabilities. It depends very much on the system and the device.

Any file may be directed to a console device for input or for output or for both.

Console Output

In normal running LynPlex directs the standard output to a console which, depending on the environment, will start off contained in a window or as a full-screen. If a LynPlex script does not write to standard output the console window will not be opened.

If standard output is being redirected to somewhere other than a console, the destination will depend on how LynPlex was invoked.

Console output is handled using the put command (see 3.02 Stream Output). There are several additional options for use specifically with consoles. These are described below.

The standard output stream is a simple stream of data. It is not considered to have any screen formatting options, although there is nothing to prevent any values being included as part of the stream. In order to tell LynPlex that console formatting is being used, the console statement must be specified, with or without any options or console must be specified on the put or get statement.

Console Input

Console input is handled using the get command (see 3.03 Stream Input). There are no further options specific to consoles.

Interactive Console

When running in interactive mode, the use of the console window is significantly different.

If LynPlex is started without a file being named on the command line, the console window opens automatically and the user is faced with a command prompt. A command can be entered in this window to run or debug a script.

For information on using LynPlex interactively see 8.01 Interactive Mode.

The CONSOLE Command

The console statement can be used to set the properties of the console. It also directs the output of any subsequent put statements through the console output processor rather than the standard output stream.

The console statement can be used without any options just to redirect the output.

It can be used to provide a name for the console, otherwise the default name of console is used.


console [name] options …

where the options are one or more of the following:

Assigns a name to the console. This is optional but if specified it must be the first word on the console statement.
Switch console to full-screen display.
Switch console to windowed display..
Specifies the console foreground and background colours.
The sub-properties are called fg and bg.
Clear the screen to the current background colour.
cursor %age
Set the cursor size as a percentage. A value of zero hides the cursor.
Reset the console to its default state.
Sound a 'beep'.



At is an instream process that moves the console cursor to the specified row and column in the console area.


at([row,] column)


put at(10,1) "text"
put at(10) "text"



Sends a stream of console control characters to the console.



where x is one or more of the control characters shown below. The following alphabetic codes are also supported

reset all attributes to their defaults
flip bold status
flip underline status
flip reverse video


put fx(b):"Bold":fx(b)

Console Formatting

Data being written to the console as a stream is normally transferred unchanged. There is, however, the possibility of providing formatting within the stream using special characters. The format characters consist of an escape character followed by a code, which usually consists of a single character.

The escape character can be defined using the OPTION CONSOLE command. As the escape character is undefined any single character may be used. The OPTION statement may be used as often as required to change the escape character.

If more than one control character is to be sent, they can be grouped together using braces ({}). The whole group can then be preceded by a single escape character.

Any string function may be included in the console output stream to provide formatting.

In addition the following may be used for formatting console output.

:>> or :<<
Carriage return/line feed suppressed after output. This is placed at the end of a PUT statement.

The following characters must all be preceded by the escape character, either singly or in a group.

next line (cr/lf)
clear screen
beginning of line (cr only)
clear to end of line
reset all attributes to their defaults
flip bold status
flip underline status
flip reverse video
send ASCII escape character (0x1b) to be implemented

Implementation Status:

LynPlex Interpreter
Standard I/O is supported on the console. The console command is also supported.
LynPlexC Compiler
Standard I/O only is supported on the console.
LynPlexS Compiler
The console statement is supported to indentify the program as using the console, otherwise standard I/O only is supported on the console.

lynplex/lp0305.txt · Last modified: 2011/11/05 20:08 by don