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

version» Context lines:

pike.git/lib/modules/Stdio.pmod/Readline.pike:117:    //!    void enable()    {    if(term->put("cr") && term->put("do"))    catch { outfd->tcsetattr((["OPOST":0])); };    else    catch { outfd->tcsetattr((["OPOST":1,"ONLCR":1,"OCRNL":0,"OLCUC":0,    "OFILL":1,"OFDEL":0,"ONLRET":0,"ONOCR":0]));};    }    -  protected void destroy() +  protected void _destruct()    {    disable();    }       //! Check and return the terminal width.    //!    //! @note    //! In Pike 7.4 and earlier this function returned @expr{void@}.    //!    //! @seealso
pike.git/lib/modules/Stdio.pmod/Readline.pike:440:    private object infd, term;    private int enabled = -1;    private function(:int) close_callback = 0;    private string prefix="";    private mapping(int:function|mapping(string:function)) bindings=([]);    private function grab_binding = 0;    private mapping oldattrs = 0;       int dumb=0;    -  protected void destroy() +  protected void _destruct()    {    catch{ infd->set_blocking(); };    if(dumb)    return;    catch{ infd->tcsetattr((["ECHO":1,"ICANON":1])); };    catch{ if(oldattrs) infd->tcsetattr((["ECHO":0,"ICANON":0,"VEOF":0,    "VEOL":0,"VLNEXT":0])&oldattrs); };    }       private string process_input(string s)
pike.git/lib/modules/Stdio.pmod/Readline.pike:1223:    if(sizeof(historylist)>1 && historylist[-2]==historylist[-1])    historylist = historylist[..<1];    }       //!    void set_max_history(int maxhist)    {    maxhistory = maxhist;    }    +  //! Pop the last string off the history, discarding it. +  //! If text is provided, will only pop that string. +  //! Returns 1 if a string was removed, 0 if not. +  int(0..1) pop(string|void text) +  { +  if (sizeof(historylist) < 2) return 0; //Not enough to pop +  if (text && historylist[-2] != text) return 0; //Wrong string +  historylist = historylist[..<2] + ({historylist[-1]}); +  return 1; +  } +     //!    void create(int maxhist, void|array(string) hist)    {    historylist = hist || ({ "" });    minhistory = historynum = 0;    maxhistory = maxhist;    }   }      
pike.git/lib/modules/Stdio.pmod/Readline.pike:1685:    historyobj = History(hist);   }      //! @fixme   //! Document this function   History get_history()   {    return historyobj;   }    - protected void destroy() + protected void _destruct()   {    if(input_controller)    destruct(input_controller);    if(output_controller)    destruct(output_controller);   }      //! Creates a Readline object, that takes input from @[infd] and has output   //! on @[outfd].   //!
pike.git/lib/modules/Stdio.pmod/Readline.pike:1711:   //!   //! @param outfd   //! Defaults to @[infd], unless @[infd] is 0, in which case   //! @[outfd] defaults to @[Stdio.stdout].   //!   //! @param outterm   //! Defaults to @[interm].   void create(object|void infd, object|string|void interm,    object|void outfd, object|string|void outterm)   { -  atexit(destroy); +  atexit(_destruct);    output_controller = OutputController(outfd || infd, outterm || interm);    input_controller = InputController(infd, interm);    DefaultEditKeys(this);   }