This function processes an input key from STDIN.
760640
function onRead (key) {
  if (key !== null) {
    if (cli.debug) console.log('Key:', key)
    // Exits on CTRL-C
    if (key === '\u0003') process.exit()
    // If enter is pressed and the program is waiting for the user to press enter
    // so that the emulator can step forward, then call the appropriate callback
    if (key.charCodeAt(0) === 13 && readingFn() && onReadCb) onReadCb(key.charCodeAt(0))
    else if (cpu) {
      // Since the CPU is initialized and the program is not waiting for the user
      // to press enter, pass the pressed key to the LC-2 CPU Console.
      cpu.console.input(key)
    }
    readingFn(false)
  }
}
473452
private BigInteger parseCharacter(String input) {
		int pos = 1;
		char c = input.charAt(pos++);
		if (c == '\\') {
			// escape code
			switch (input.charAt(pos++)) {
			case 'b':
				c = '\b';
				break;
			case 't':
				c = '\t';
				break;
			case 'n':
				c = '\n';
				break;
			case 'f':
				c = '\f';
				break;
			case 'r':
				c = '\r';
				break;
			case '"':
				c = '\"';
				break;
			case '\'':
				c = '\'';
				break;
			case '\\':
				c = '\\';
				break;
			default:
				throw new RuntimeException("unrecognised escape character");
			}
		}
		return BigInteger.valueOf(c);
	}
970371
private void processInput(boolean endOfInput) throws IOException {
        // Prepare decoderIn for reading
        decoderIn.flip();
        CoderResult coderResult;
        while (true) {
            coderResult = decoder.decode(decoderIn, decoderOut, endOfInput);
            if (coderResult.isOverflow()) {
                flushOutput();
            } else if (coderResult.isUnderflow()) {
                break;
            } else {
                // The decoder is configured to replace malformed input and unmappable characters,
                // so we should not get here.
                throw new IOException("Unexpected coder result");
            }
        }
        // Discard the bytes that have been read
        decoderIn.compact();
    }
1325715
def set_input(self, key, value):
        
        if key not in self._inputs:
            raise InputException("Key {0} is not a valid input!".format(key))
        self._inputs[key].value = value
853436
def process_stdin(line):
    ''''''
    if line is None:
        sys.exit(0)
    # allow for modules to override input handling
    if mpstate.functions.input_handler is not None:
          mpstate.functions.input_handler(line)
          return

    line = line.strip()

    if mpstate.status.setup_mode:
        # in setup mode we send strings straight to the master
        if line == '.':
            mpstate.status.setup_mode = False
            mpstate.status.flightmode = "MAV"
            mpstate.rl.set_prompt("MAV> ")
            return
        if line != '+++':
            line += '\r'
        for c in line:
            time.sleep(0.01)
            mpstate.master().write(c)
        return

    if not line:
        return

    args = shlex.split(line)
    cmd = args[0]
    while cmd in mpstate.aliases:
        line = mpstate.aliases[cmd]
        args = shlex.split(line) + args[1:]
        cmd = args[0]

    if cmd == 'help':
        k = command_map.keys()
        #k.sort()
        for cmd in k:
            (fn, help) = command_map[cmd]
            print("%-15s : %s" % (cmd, help))
        return
    if cmd == 'exit' and mpstate.settings.requireexit:
        mpstate.status.exit = True
        return
    ######################################################################################################
    if cmd == 'velocity' and len(args) == 4:
        PH_CMDVel = CMDVelI(args[1],args[2],args[3],0,0,0) #1 to avoid indeterminations






    ######################################################################################################
    if not cmd in command_map:
        for (m,pm) in mpstate.modules:
            if hasattr(m, 'unknown_command'):
                try:
                    if m.unknown_command(args):
                        return
                except Exception as e:
                    print("ERROR in command: %s" % str(e))
        print("Unknown command '%s'" % line)
        return

    (fn, help) = command_map[cmd]
    try:
        fn(args[1:])
    except Exception as e:
        print("ERROR in command %s: %s" % (args[1:], str(e)))
        if mpstate.settings.moddebug > 1:
            traceback.print_exc()
29040
def _inputLoop(self):
        
        try:
            while self.alive:
                try:
                    c = console.getkey()                    
                except KeyboardInterrupt:
                    print('kbint')
                    c = serial.to_bytes([3])
                if c == self.EXIT_CHARACTER: 
                    self.stop()
                elif c == '\n':
                    # Convert newline input into \r
                    self.serial.write(self.WRITE_TERM)
                    if self.echo:
                        # Locally just echo the real newline
                        sys.stdout.write(c)
                        sys.stdout.flush()
                else:
                    #print('writing: ', c)
                    self.serial.write(c)
                    if self.echo:
                        sys.stdout.write(c)
                        sys.stdout.flush()
        except:
            self.alive = False
            raise
875089
public void process(InputStream input) throws IOException, ConverterException {
        while (0 != input.available()) {
            Tag tag = ParserUtils.parseTag(input);
            TagHandler handler = getHandler(tag);
            if (null == handler) {
                skipHandler.handle(tag, input);
            } else {
                handler.handle(tag, input);
            }
        }
    }
1244363
private void pumpInputData() throws IOException {
    for (Input input : inputs) {
      if (input.pump == null) {
        continue;
      }
      OutputStream os;
      if (input.pipeName.equals(STDIN_FILE_NAME)) {
        os = process.getOutputStream();
      } else {
        throw new IOException("Only stdin piping is supported so far.");
      }
      input.pump.pump(os);
    }
  }
198187
def filter_input(keys, raw):
    """"""
    if len(keys) == 1:
        if keys[0] in UI.keys['up']:
            keys[0] = 'up'
        elif keys[0] in UI.keys['down']:
            keys[0] = 'down'
        elif len(keys[0]) == 4 and keys[0][0] == 'mouse press':
            if keys[0][1] == 4:
                keys[0] = 'up'
            elif keys[0][1] == 5:
                keys[0] = 'down'
    return keys
1350169
def process_input(self):
        
        try:
            character = self.window.getch()
        except Exception as e:
            character = -1
            if self.debug:
                self.addstr(self.height-1, self.width - len(e.message) + 1, e.message)

        # Check for any keys we've been told to exit on
        if character in self.exit_keys:
            self.stop()

        # Force redraw the screen on ^L
        if character == 12:
            self.window.clear()
            return

        # Send input to active panes (hidden panes can still receive input)
        if character != -1:
            [pane.process_input(character) for pane in self if pane.active ]

            # Print character codes to the bottom center if debugging.
            if self.debug:
                self.addstr(self.height-1, self.width/2, " "*4)
                self.addstr(self.height-1, self.width/2 - len(str(character)) / 2, str(character))
781176
function _keyboard_interactive_process()
    {
        $responses = func_get_args();

        $response = $this->_get_binary_packet();
        if ($response === false) {
            user_error('Connection closed by server', E_USER_NOTICE);
            return false;
        }

        extract(unpack('Ctype', $this->_string_shift($response, 1)));

        switch ($type) {
            case NET_SSH2_MSG_USERAUTH_INFO_REQUEST:
                // see http://tools.ietf.org/html/rfc4256#section-3.2
                if (defined('NET_SSH2_LOGGING')) {
                    $this->message_number_log[count($this->message_number_log) - 1] = str_replace(
                        'UNKNOWN',
                        'NET_SSH2_MSG_USERAUTH_INFO_REQUEST',
                        $this->message_number_log[count($this->message_number_log) - 1]
                    );
                }

                extract(unpack('Nlength', $this->_string_shift($response, 4)));
                $this->_string_shift($response, $length); // name; may be empty
                extract(unpack('Nlength', $this->_string_shift($response, 4)));
                $this->_string_shift($response, $length); // instruction; may be empty
                extract(unpack('Nlength', $this->_string_shift($response, 4)));
                $this->_string_shift($response, $length); // language tag; may be empty
                extract(unpack('Nnum_prompts', $this->_string_shift($response, 4)));
                /*
                for ($i = 0; $i < $num_prompts; $i++) {
                    extract(unpack('Nlength', $this->_string_shift($response, 4)));
                    // prompt - ie. "Password: "; must not be empty
                    $this->_string_shift($response, $length);
                    $echo = $this->_string_shift($response) != chr(0);
                }
                */

                /*
                   After obtaining the requested information from the user, the client
                   MUST respond with an SSH_MSG_USERAUTH_INFO_RESPONSE message.
                */
                // see http://tools.ietf.org/html/rfc4256#section-3.4
                $packet = $logged = pack('CN', NET_SSH2_MSG_USERAUTH_INFO_RESPONSE, count($responses));
                for ($i = 0; $i < count($responses); $i++) {
                    $packet.= pack('Na*', strlen($responses[$i]), $responses[$i]);
                    $logged.= pack('Na*', strlen('dummy-answer'), 'dummy-answer');
                }

                if (!$this->_send_binary_packet($packet)) {
                    return false;
                }

                if (defined('NET_SSH2_LOGGING')) {
                    $this->message_number_log[count($this->message_number_log) - 1] = str_replace(
                        'UNKNOWN',
                        'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE',
                        $this->message_number_log[count($this->message_number_log) - 1]
                    );
                    $this->message_log[count($this->message_log) - 1] = $logged;
                }

                /*
                   After receiving the response, the server MUST send either an
                   SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, or another
                   SSH_MSG_USERAUTH_INFO_REQUEST message.
                */
                // maybe phpseclib should force close the connection after x request / responses?  unless something like that is done
                // there could be an infinite loop of request / responses.
                return $this->_keyboard_interactive_process();
            case NET_SSH2_MSG_USERAUTH_SUCCESS:
                return true;
            case NET_SSH2_MSG_USERAUTH_FAILURE:
                return false;
        }

        return false;
    }
1113183
def _ask
      input = STDIN.gets.chomp
      input = @default if input.empty? && @default
      @fd.puts if @secret
      input
    end
552023
def input(self, _in, out, **kwargs):
        """"""
        language_code = _re_language_code.search(_in.read()).group(
            'language_code'
        )
        _in.seek(0)  # move at the begining after matching the language
        catalog = read_po(_in)
        out.write('gettextCatalog.setStrings("{0}", '.format(language_code))
        out.write(json.dumps({
            key: value.string for key, value in catalog._messages.items()
            if key and value.string
        }))
        out.write(');')
372106
function handleKeydown(keyCodes, e, callback) {
    const keyCode = e.charCode || e.keyCode;
    if (keyCodes.indexOf(keyCode) !== -1) {
        callback();
    }
}
126319
def process_inputs(self):
        
        ret = []
        files = self.args.files
        if files is None:
            return ret

        for fname in files:
            if fname == '-':
                if self.args.base64stdin:
                    for line in sys.stdin:
                        data = base64.b64decode(line)
                        ret.append(self.process_file(data, fname))

                    continue
                else:
                    fh = sys.stdin

            elif fname.endswith('.tar') or fname.endswith('.tar.gz'):
                sub = self.process_tar(fname)
                ret.append(sub)
                continue

            elif not os.path.isfile(fname):
                sub = self.process_dir(fname)
                ret.append(sub)
                continue

            else:
                fh = open(fname, 'rb')

            with fh:
                data = fh.read()
                sub = self.process_file(data, fname)
                ret.append(sub)

        return ret
704616
def handle_input(*input)
      while ch = next_ch(input)
        quit  = QUIT_CONTROLS.include?(ch)
        enter = ENTER_CONTROLS.include?(ch)
        inc   = INC_CONTROLS.include?(ch)
        dec   = DEC_CONTROLS.include?(ch)

        break if shutdown? ||
                (quit && (!enter || quit_on_enter?))

        if enter
          on_enter

        elsif inc
          on_inc

        elsif dec
          on_dec
        end

        if key_bound?(ch)
          invoke_key_bindings(ch)
        end

        on_key(ch)
      end

      ch
    end
459269
def stdin_read(self, data):
        

        data = data.strip().decode("utf-8")
        self.log("Incoming:", data, lvl=verbose)

        if len(data) == 0:
            self.log('Use /help to get a list of enabled cli hooks')
            return

        if data[0] == "/":
            cmd = data[1:]
            args = []
            if ' ' in cmd:
                cmd, args = cmd.split(' ', maxsplit=1)
                args = args.split(' ')
            if cmd in self.hooks:
                self.log('Firing hooked event:', cmd, args, lvl=debug)
                self.fireEvent(self.hooks[cmd](*args))
            # TODO: Move these out, so we get a simple logic here
            elif cmd == 'frontend':
                self.log("Sending %s frontend rebuild event" %
                         ("(forced)" if 'force' in args else ''))
                self.fireEvent(
                    frontendbuildrequest(force='force' in args,
                                         install='install' in args),
                    "setup")
            elif cmd == 'backend':
                self.log("Sending backend reload event")
                self.fireEvent(componentupdaterequest(force=False), "setup")
            else:
                self.log('Unknown Command:', cmd, '. Use /help to get a list of enabled '
                                                  'cli hooks')