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.47 2003/06/26 23:06:03 nilsson Exp $ + // $Id: Readline.pike,v 1.48 2003/07/01 15:45:35 per Exp $   #pike __REAL_VERSION__      class OutputController   {    static private .File outfd;    static private .Terminfo.Termcap term;    static private int xpos = 0, columns = 0;    static private mapping oldattrs = 0;      #define BLINK 1
pike.git/lib/modules/Stdio.pmod/Readline.pike:401:    //!    void beep()    {    outfd->write(term->put("bl")||"");    }       //!    void create(.File|void _outfd,    .Terminfo.Termcap|string|void _term)    { -  outfd = _outfd || .stdout; +  outfd = _outfd || Stdio.File( "stdout", "w" );    term = objectp(_term)? _term : .Terminfo.getTerm(_term);    catch { oldattrs = outfd->tcgetattr(); };    check_columns();    }   }      class InputController   {    static private object infd, term;    static private int enabled = -1;
pike.git/lib/modules/Stdio.pmod/Readline.pike:496:    static private int set_enabled(int e)    {    if (e != enabled)    {    enabled = e;    if (enabled)    {    string oldprefix = prefix;    prefix = "";    prefix = process_input(oldprefix); -  infd->set_nonblocking(read_cb, 0, close_cb); +  infd->set_read_callback( read_cb ); +  infd->set_close_callback( close_cb );    }    else    infd->set_blocking();    return !enabled;    }    else    return enabled;    }       //!
pike.git/lib/modules/Stdio.pmod/Readline.pike:742:    mapping(int:function) bb = bindings-Array.filter(bindings, mappingp);    return `|(mkmapping(Array.map(indices(bb), lambda(int n) {    return sprintf("%c", n);    }), values(bb)),    @Array.filter(values(bindings), mappingp));    }       //!    void create(object|void _infd, object|string|void _term)    { -  infd = _infd || .stdin; +  infd = _infd || Stdio.File( "stdin", "r" );    term = objectp(_term)? _term : .Terminfo.getTerm(_term);    disable();    if(search(term->aliases, "dumb")>=0) {    // Dumb terminal. Don't try anything fancy.    dumb = 1;    return;    }    catch { oldattrs = infd->tcgetattr(); };    if(catch { infd->tcsetattr((["ECHO":0])); }) {    // If echo can't be disabled, Readline won't work very well.