In the console, programs often have to change modes of IO operation. For example to handle escape sequences, or to draw in special ways on the screen. INITKB^XGF() in the VistA system, will set up a special processing to enable arrow keys. And when done, one my USE $P to return to prior functioning.
I have been having trouble with AUTOMARG^XVEMKY, which issues an escape sequence to query the terminal as to its actual size. Sometimes this works and sometimes it doesn't. I big variable seems to be if I have run my debugger first. When I do, it apparently changes some parameter such that it doesn't work. And I am having a hard time figuring out the problem.
In my debugger, as I display to the screen the current
program location and code text listing, I first save off the current
device, draw the screen, then try to restore the previous IO
environment.
SET SAVEDIO=$IO
then USE $P:(WIDTH=tmgScrWidth:NOWRAP)
then <draw to screen>
then USE SAVEDIO <--------- This will loose any prior device parameters.
Again, this works most of the time, but not always.
The problem is that if $IO has some device parameters, such as NOWRAP etc etc, then these will be lost.
yottadb>zshow "D"
/dev/pts/1 OPEN TERMINAL NOPAST NOESCA NOREADS TYPE WIDTH=165 LENG=51 FIL=ESCAPES
Above
seems to show some device parameters that I could parse out , but I
don't recognize that "OPEN" and "TERMINAL" parts. Should I just start
at the 4th one and onward?
Questions:
1) I have never seen anyone else's code seem to try to save off device parameters when switching, so that the prior can be restored. Is this not needed? What am I missing?
2) What are the 'OPEN' and 'TERMINAL' entries from the zshow "D" from above?
3) Does ZSHOW "D" show all the information known about a device? For example, I think that $X and $Y are device dependent. And I suspect that after switching, they will be restored. How would one see that info? And having to manually parse of the text output from ZSHOW seems archaic. Is there not a more direct way?
4) $IO stores the current device, but not the current device parameters. Why does M depend on a YottaDB extension to provide access to device parameters?
Thanks in advance.
Kevin