(go to: table of contents, index, list of vms_smg, prev: PREV, next: READ_KEYSTROKE)
Format:
The 'b' in the last line appears bold, the 'r' in the last line appears reverse
and the 'u' in the last line appears underlined.
READ_FROM_DISPLAY - Read Text from Display
Read a line of text from a virtual display.
status, resultant_string, rendition_string = \
vms_smg.read_from_display (display_id, \
[terminator_string], [start_row])
Returns:
Arguments:
Examples:
(go to: table of contents,
index, list of vms_smg,
prev: PREV,
next: READ_KEYSTROKE)
>>> import vms_smg
>>> import vms_smgdef
>>> # create a new DECwindows terminal using SMG
>>> status, pasteboard_id, number_of_pasteboard_rows, \
... number_of_pasteboard_columns, type_of_terminal, \
... device_name = vms_smg.create_pasteboard \
... (None, vms_smgdef.SMG_M_WORKSTATION)
>>>
>>> # create virtual display
>>> status, vtdpy1 = vms_smg.create_virtual_display \
... (5, 10, vms_smgdef.SMG_M_BORDER, None, None)
>>>
>>> # paste virtual display
>>> status = vms_smg.paste_virtual_display \
... (vtdpy1, pasteboard_id, 3, 5, None)
>>>
>>> # put characters on virtual display
>>> status = vms_smg.put_chars (vtdpy1, '1234567890', 1, 1)
>>> status = vms_smg.put_chars (vtdpy1, 'ABCDEFGHIJ', 2, 1)
>>> status = vms_smg.put_chars (vtdpy1, 'KLMNOPQRST', 3, 1)
>>> status = vms_smg.put_chars (vtdpy1, 'abcdefghij', 4, 1)
>>> status = vms_smg.put_chars (vtdpy1, 'klmnopqrst', 5, 1)
>>>
>>> # position cursor
>>> vms_smg.set_cursor_abs (vtdpy1, 2, 2)
>>>
>>> # put line on virtual display
>>> status = vms_smg.put_line_multi (vtdpy1, 'VTDPY1')
>>> # position cursor
>>> vms_smg.set_cursor_abs (vtdpy1, 3, 2)
>>>
>>> # write to virtual display - graphics
>>> status = vms_smg.put_line_multi (vtdpy1, 'qnqxq', None, None, \
... 0, None, None, vms_smgdef.SMG_C_SPEC_GRAPHICS)
>>>
>>> # position cursor
>>> vms_smg.set_cursor_abs (vtdpy1, 5, 2)
>>> rendition_string = chr(vms_smgdef.SMG_M_BOLD) + \
... chr(vms_smgdef.SMG_M_REVERSE) + \
... chr(vms_smgdef.SMG_M_UNDERLINE)
>>> # caution - these are control characters that can screw up
>>> # a terminal's setting! - use repr() for inspection
>>> print repr (rendition_string)
'\001\002\010'
>>>
>>> status = vms_smg.put_line_multi (vtdpy1, 'bru', \
... rendition_string, None, \
... 0, 0, vms_smgdef.SMG_M_UP, \
... vms_smgdef.SMG_C_ASCII)
>>>
>>> # read from display ...
>>> status, resultant_string, rendition_string = \
... vms_smg.read_from_display (vtdpy1, None, 5)
>>>
>>> print status, repr(resultant_string)
1 'kbru '
>>>
>>> # WARNING! the 'rendition_string' contains binary values
>>> print repr(rendition_string)
'\000\001\002\010\000\000\000\000\000\000'
>>>
>>> def show_rendition(rendition_string):
... import string, vms_smgdef
... # loop over the |rendition_string|
... for rendition_char in rendition_string:
... # convert to integer
... rendition_complement = ord(rendition_char)
... # an empty list
... rendition_name = []
... if (rendition_complement & vms_smgdef.SMG_M_BLINK):
... rendition_name.append ('BLINK')
... if (rendition_complement & vms_smgdef.SMG_M_BOLD):
... rendition_name.append ('BOLD')
... if (rendition_complement & vms_smgdef.SMG_M_REVERSE):
... rendition_name.append ('REVERSE')
... if (rendition_complement & vms_smgdef.SMG_M_UNDERLINE):
... rendition_name.append ('UNDERLINE')
... if (rendition_complement & vms_smgdef.SMG_M_INVISIBLE):
... rendition_name.append ('INVISIBLE')
... # all rendition 'names' in one string
... rendition_text = string.join(rendition_name,',')
... print ord(rendition_char), rendition_text
...
>>> show_rendition(rendition_string)
0
1 BOLD
2 REVERSE
8 UNDERLINE
0
0
0
0
0
0
>>>