module lib$ttio ( addressing_mode (external = general, nonexternal = general), ident = 'V1-002' ) = ( library 'sys$library:starlet'; literal tt$m_image = tt$m_eightbit or tt$m_passall; own initialized : long initial (0), tty_chan : long, modes : vector [2, long], sys$input : block [9, byte], sys$input_buf : vector [9, byte] initial (byte ('SYS$INPUT')); routine initialize : novalue = ( local status; sys$input[dsc$w_length] = 9; sys$input[dsc$a_pointer] = sys$input_buf; status = $assign ( chan = tty_chan, devnam = sys$input ); if not .status then $exit (code = .status); initialized = 1; ); global routine tty$getc = ( local buffer : vector [4, byte], status; if not .initialized then initialize(); status = $qiow ( chan = .tty_chan, func = io$_readvblk or io$m_noecho or io$m_nofiltr, p1 = buffer, p2 = 1 ); return .buffer[0]; ); global routine tty$putc (buffer) : novalue = ( local status; map buffer : ref block [, byte]; if not .initialized then initialize(); status = $qiow ( chan = .tty_chan, func = io$_writevblk, p1 = .buffer[dsc$a_pointer], p2 = 1 ); ); global routine tty$echo (on) = ( local old_value, status; if not .initialized then initialize(); status = $qiow ( chan = .tty_chan, func = io$_sensemode, p1 = modes ); old_value = (if (.modes[1] and tt$m_noecho) eql 0 then 1 else 0); if ..on then modes[1] = .modes[1] and not tt$m_noecho else modes[1] = .modes[1] or tt$m_noecho; status = $qiow ( chan = .tty_chan, func = io$_setmode, p1 = modes ); return .old_value; ); global routine tty$image (on) = ( local old_value, status; if not .initialized then initialize(); status = $qiow ( chan = .tty_chan, func = io$_sensemode, p1 = modes ); old_value = (if (.modes[1] and tt$m_image) neq 0 then 1 else 0); if ..on then modes[1] = .modes[1] or tt$m_image else modes[1] = .modes[1] and not tt$m_image; status = $qiow ( chan = .tty_chan, func = io$_setmode, p1 = modes ); return .old_value; ); ) eludom