The @ function is used to position the cursor to a specific point on the terminal screen.The function can be used as follows:
- col and row can be any expression that evaluates to a numeric value.
- col specifies, to which column on the screen the cursor should be moved.
- row specifies which row (line) on the screen to position the cursor.
Specifying col on its own will locate the cursor to the required column on whichever row it currently occupies. The terminal address starts at (0,0), that being the top left hand corner of the screen.
When specified values exceed either of the physical limits of the current terminal, then unpredictable results will occur.
Cursor addressing will not normally work when directed at a printer. Building printer independence into a program can be achieved by accessing the terminfo database through the SYSTEM() function.
If the function is given a screen code as an argument as below:
Where screen_code is any valid jBASIC screen code, the function can be used to control the behavior of the display screen. Screen color can also be controlled. For example:
CRT @(-1):@(2, 30):"Hi there!":
The above can be used to clear the screen before the greeting "Hi there!" is displayed at the location specified by the second @ function.
Some valid screen codes are listed below:
|-1||clear the screen and home the cursor.|
|-2||home the cursor.|
|-3||clear screen from the cursor to the end of the screen.|
|-4||clear screen from cursor to the end of the current screen line.|
|-9||move the cursor one character to the left.|
|-10||move the cursor one row up the screen.|
Other @ codes include:
|@CALLSTACK||Call stack (i.e. if used in a subroutine)|
|@CODEPAGE||For International mode|
|@DATA||DATA input (e.g. when using EXECUTE)|
|@DAY||Calendar day number of the month|
|@FF||Form feed character for printing|
|@FILENAME||Used in I-type dictionaries|
|@ID||Used in I-type dictionaries|
|@LEVEL||EXECUTE level of nesting|
|@LOCALE||For International mode|
|@LOGNAME||Operating system login name|
|@MONTH||Current month number|
|@PATH||Current working directory|
|@RECORD||Used in I-type dictionaries|
|@SELECTED||Item count from active select|
|@TTY||Current tty device|
|@UID||Operating system user ID|
|@USER||Operating system login name|
|@USERNO||jBASE port number|
|@USERSTATS||Current user statistics:|
1> The port number
<2> The number of programs running in this port.
<3> Time the user started in Universal Co-ordinated Time or UTC (not a dyslexic mistake). This is raw UNIX time. You can convert this to jBASE internal time format using the U0FF0 conversion or to internal date format using the U0FF1 conversion.
<4> The process ID
<5> Account name
<6> User name. Normally the operating system name.
<7> Terminal name in jBASE format
<8> Terminal name in Operating system format.
<9> Database name
<10> TTY device name
<11> Language name.
<12> Time in UTC the listening thread last found the thread alive.
<13> Amount of heap space memory in free space chain on a process wide basis. Not real-time, only updated every 15 seconds.
<14> Amount of heap space memory in use on a process wide basis. Not real-time , only updated every 15 seconds
<15> Thread type as an internal integer.
<16> Type of thread as a text string.
<17> License counters
<18> Number of OPEN’s performed.
<19> Number of READ’s performed.
<20> Number of WRITE's performed.
<21> Number of DELETE's performed
<22> Number of CLEARFILE's performed
<23> Number of PERFORM/EXECUTE's performed.
<24> Number of INPUT's performed.
<25> Not used.
<26> Number of jBASE files the application thinks it has open at the moment.
<27> Number of jBASE files actually opened by the operating system at the moment.
<28> Any data set by the application using @USER.ROOT
<29> Process Identifier. A string created by the operating system to identify the process. It is O/S specific. Currenly on IBM i-series platform only.
<30> to <40> Reserved.
Attributes 41 onward are multi-valued, one value per perform level, and there are <2> perform levels active.
<41,n> Program name and command line arguments.
<42,n> The line number in jBASE BASIC the program is currently executing.
<43,n> The source name in jBASE BASIC the program is currently executing.
<44,n> Not used.
<45,n> Not used.
<46,n> Status of program execution as a readable text string.
<47,n> Status of program execution as an internal integer.
<48,n> User CPU time . Depending upon the hardware this will be either for the entire process or just the single thread.
<49,n> System CPU time.Depending upon the hardware this will be either for the entire process or just the single thread.
<50,n> User CPU time used by any external child processes it might have spawned.
<51,n> System CPU time used by any external child processes it might have spawned.
<52,n> Any data set by the application using @USER.THREAD
|@YEAR||Current year number|
Go back to jBASE BASIC.