def readline_internal_charloop()
lastc = -1
eof_found = false
while (!@rl_done)
lk = @_rl_last_command_was_kill
if (@rl_pending_input == 0)
_rl_reset_argument()
@rl_key_sequence_length = 0
end
rl_setstate(RL_STATE_READCMD)
c = rl_read_key()
rl_unsetstate(RL_STATE_READCMD)
if (c == READERR)
eof_found = true
break
end
if (c == EOF && @rl_end!=0)
c = NEWLINE
end
if (((c == @_rl_eof_char && lastc != c) || c == EOF) && @rl_end==0)
eof_found = true
break
end
lastc = c
if _rl_dispatch(c, @_rl_keymap)== -1
next
end
if (@rl_pending_input == 0 && lk == @_rl_last_command_was_kill)
@_rl_last_command_was_kill = false
end
_rl_internal_char_cleanup()
end
eof_found
end