pike.git / lib / modules / Stdio.pmod / Readline.pike

version» Context lines:

pike.git/lib/modules/Stdio.pmod/Readline.pike:1: - // $Id: Readline.pike,v 1.6 1999/03/23 18:01:48 marcus Exp $ + // $Id: Readline.pike,v 1.7 1999/03/23 18:30:06 marcus Exp $      class OutputController   {    static private object outfd, term;    static private int xpos = 0, columns = 0;    static private mapping oldattrs = 0;       void disable()    {    catch{
pike.git/lib/modules/Stdio.pmod/Readline.pike:326:    return set_enabled(!!e[0]);    else    return set_enabled(1);    }       int disable()    {    return set_enabled(0);    }    -  void run_blocking() +  int run_blocking()    {    disable();    string data = prefix;    prefix = "";    enabled = 1;    for (;;)    {    prefix = process_input(data);    if (!enabled) -  return; +  return 0;    data = prefix+infd->read(1024, 1);    prefix = "";    if(!data || !sizeof(data)) {    disable(); -  return; +  return -1;    }    }    }       void set_close_callback(function (:int) ccb)    {    close_callback = ccb;    }       void nullbindings()
pike.git/lib/modules/Stdio.pmod/Readline.pike:949:   string read()   {    if(newline_func == read_newline)    return 0;    function oldnl = newline_func;    output_controller->write(prompt);    initline();    newline_func = read_newline;    readtext = "";    output_controller->enable(); -  input_controller->run_blocking(); +  int res = input_controller->run_blocking();    set_nonblocking(oldnl); -  return readtext; +  return (res>=0 || sizeof(readtext)) && readtext;   }      void enable_history(object(History)|int hist)   {    if (objectp(hist))    historyobj = hist;    else if(!hist)    historyobj = 0;    else if(historyobj)    historyobj->set_max_history(hist);