Expand/Shrink

video_config

Definition: sequence s = video_config()
Description: Returns a sequence of 10 non-negative integer values describing the current video configuration. Somewhat a legacy routine from DOS32 days, which may however still be useful for some items (4 out of 10, ie {3,4,9,10}):

Constant Value Description
VC_COLOR 1 was colour/monochrome flag, now always 1
VC_MODE 2 was current video mode, now always 3
VC_LINES 3 number of text rows in console buffer
VC_COLUMNS 4 number of text columns in console buffer
VC_XPIXELS 5 was screen width in pixels, now always 0
VC_YPIXELS 6 was screen height in pixels, now always 0
VC_NCOLORS 7 was number of colors, now always 32
VC_PAGES 8 was number of display pages, now always 1
VC_SCRNLINES 9 number of text rows for current screen size
VC_SCRNCOLS 10 number of text columns for current screen size
pwa/p2js: Not properly supported, but returns the constant {1,3,25,80,0,0,32,1,25,80}, ie assumes a 25x80 screen.
Not however that position() and get_position() are (really) not supported under pwa/p2js.
Comments: Beyond saying that VC_LINES and VC_COLUMNS are the size of the buffer, usually larger than VC_SCRNLINES and VC_SCRNCOLS, which are the size of the visible area, the choice of which is required is application specific, however the last two items are probably more likely to be useful.

In Phix, the VC_XXX constants are automatically defined, see psym.e/syminit().

On Linux, simply returns the constant {1,3,25,80,0,0,32,1,25,80}, ie assumes a 25x80 screen. Should anyone know of any way to obtain the current terminal size (in characters), let me know.
Example:
vc = video_config()   -- vc is eg {1, 3, 300, 80, 0, 0, 32, 1, 25, 80}
if length(vc)>=VC_SCRNCOLS then
    lines = vc[VC_SCRNLINES]
    cols = vc[VC_SCRNCOLS]
else -- (RDS Eu compatibility)
    lines = vc[VC_LINES]
    cols = vc[VC_COLUMNS]
end if
Compatibility: RDS Eu requires include graphics.e and returns a sequence of 8 elements only.
Euphoria requires include std\graphcst.e

Should you require a routine that is compatible across Phix, RDS Eu, and Euphoria, then I suggest that you adapt/rename the one in builtins\pscreen.e, and perhaps rely on/copy the VC_XXX constants in builtins\graphics.e, rather than struggle with those other include files/builtins, especially with regards to RDS Eu.
Implementation: See builtins\pscreen.e (an autoinclude) for details of the actual implementation.