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.44 2003/01/20 17:44:01 nilsson Exp $ + // $Id: Readline.pike,v 1.45 2003/05/04 21:27:09 nilsson Exp $   #pike __REAL_VERSION__      class OutputController   {    static private object(Stdio.File) outfd;    static private object(Stdio.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:371:    xpos = 0;    }    outfd->write(term->put("cd")||"");    }       void beep()    {    outfd->write(term->put("bl")||"");    }    -  void create(object(Stdio.File)|void _outfd, -  object(Stdio.Terminfo.Termcap)|string|void _term) +  void create(Stdio.File|void _outfd, +  Stdio.Terminfo.Termcap|string|void _term)    {    outfd = _outfd || Stdio.File("stdout");    term = objectp(_term)? _term : .Terminfo.getTerm(_term);    catch { oldattrs = outfd->tcgetattr(); };    check_columns();    }      }      class InputController
pike.git/lib/modules/Stdio.pmod/Readline.pike:720:    return;    }    catch { infd->tcsetattr((["ECHO":0,"ICANON":0,"VMIN":1,"VTIME":0,    "VLNEXT":0])); };    }      }      class DefaultEditKeys   { -  static private multiset word_break_chars = mkmultiset("\t \n\r/*?_-.[]~&;\!#$%^(){}<>\"'`"/""); +  static private multiset word_break_chars = +  mkmultiset("\t \n\r/*?_-.[]~&;\!#$%^(){}<>\"'`"/"");    static object _readline;       void self_insert_command(string str)    {    _readline->insert(str, _readline->getcursorpos());    }       void quoted_insert()    {    _readline->get_input_controller()->grabnextkey(self_insert_command);
pike.git/lib/modules/Stdio.pmod/Readline.pike:1074:    void create(int maxhist, void|array(string) hist)    {    historylist = hist || ({ "" });    minhistory = historynum = 0;    maxhistory = maxhist;    }      }       - static private object(OutputController) output_controller; - static private object(InputController) input_controller; + static private OutputController output_controller; + static private InputController input_controller;   static private string prompt="";   static private array(string) prompt_attrs=0;   static private string text="", readtext;   static private function(string:void) newline_func;   static private int cursorpos = 0;   static private int mark = 0; - /*static private */ object(History) historyobj = 0; + /*static private */ History historyobj = 0;   static private int hide = 0;      static private array(string) kill_ring=({});   static private int kill_ring_size=30;      //! get current output control object   //! @returns   //! Terminal output controller object - object(OutputController) get_output_controller() + OutputController get_output_controller()   {    return output_controller;   }      //! get current input control object   //! @returns   //! Terminal input controller object - object(InputController) get_input_controller() + InputController get_input_controller()   {    return input_controller;   }      //! Return the current prompt string.   string get_prompt()   {    return prompt;   }   
pike.git/lib/modules/Stdio.pmod/Readline.pike:1510:      //! @fixme   //! Document this function   string read(string|void prompt, array(string)|void attrs)   {    return edit("", prompt, attrs);   }      //! @fixme   //! Document this function - void enable_history(array(string)|object(History)|int hist) + void enable_history(array(string)|History|int hist)   {    if (objectp(hist))    historyobj = hist;    else if(arrayp(hist))    historyobj = History(512,hist);    else if(!hist)    historyobj = 0;    else if(historyobj)    historyobj->set_max_history(hist);    else    historyobj = History(hist);   }      //! @fixme   //! Document this function   History get_history()   {    return historyobj;   }    - //! @fixme - //! Document this function - void destroy() - { -  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].   //!   //! @param infd   //! Defaults to @[Stdio.stdout].   //!   //! @param interm   //! Defaults to @[Stdio.Terminfo.getTerm()].   //!   //! @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); +     output_controller = OutputController(outfd || infd, outterm || interm);    input_controller = InputController(infd, interm);    DefaultEditKeys(this_object());   }