Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / module-readline.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="module-rlcompleter.html" />
13<link rel="prev" href="module-tarfile.html" />
14<link rel="parent" href="someos.html" />
15<link rel="next" href="readline-example.html" />
16<meta name='aesop' content='information' />
17<title>7.20 readline -- GNU readline interface</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="7.19.3 Examples"
25 href="tar-examples.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="7. Optional Operating System"
28 href="someos.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="7.20.1 Example"
31 href="readline-example.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="tar-examples.html">7.19.3 Examples</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="someos.html">7. Optional Operating System</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="readline-example.html">7.20.1 Example</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION0092000000000000000000">
567.20 <tt class="module">readline</tt> --
57 GNU readline interface</A>
58</H1>
59
60<P>
61<A NAME="module-readline"></A>
62<p class="availability">Availability: <span
63 class="platform">Unix</span>.</p>
64
65<P>
66The <tt class="module">readline</tt> module defines a number of functions used either
67directly or from the <tt class="module"><a href="module-rlcompleter.html">rlcompleter</a></tt> module to facilitate
68completion and history file read and write from the Python
69interpreter.
70
71<P>
72The <tt class="module">readline</tt> module defines the following functions:
73
74<P>
75<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
76 <td><nobr><b><tt id='l2h-2941' xml:id='l2h-2941' class="function">parse_and_bind</tt></b>(</nobr></td>
77 <td><var>string</var>)</td></tr></table></dt>
78<dd>
79Parse and execute single line of a readline init file.
80</dl>
81
82<P>
83<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
84 <td><nobr><b><tt id='l2h-2942' xml:id='l2h-2942' class="function">get_line_buffer</tt></b>(</nobr></td>
85 <td><var></var>)</td></tr></table></dt>
86<dd>
87Return the current contents of the line buffer.
88</dl>
89
90<P>
91<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
92 <td><nobr><b><tt id='l2h-2943' xml:id='l2h-2943' class="function">insert_text</tt></b>(</nobr></td>
93 <td><var>string</var>)</td></tr></table></dt>
94<dd>
95Insert text into the command line.
96</dl>
97
98<P>
99<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
100 <td><nobr><b><tt id='l2h-2944' xml:id='l2h-2944' class="function">read_init_file</tt></b>(</nobr></td>
101 <td><var></var><big>[</big><var>filename</var><big>]</big><var></var>)</td></tr></table></dt>
102<dd>
103Parse a readline initialization file.
104The default filename is the last filename used.
105</dl>
106
107<P>
108<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
109 <td><nobr><b><tt id='l2h-2945' xml:id='l2h-2945' class="function">read_history_file</tt></b>(</nobr></td>
110 <td><var></var><big>[</big><var>filename</var><big>]</big><var></var>)</td></tr></table></dt>
111<dd>
112Load a readline history file.
113The default filename is <span class="file">~/.history</span>.
114</dl>
115
116<P>
117<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
118 <td><nobr><b><tt id='l2h-2946' xml:id='l2h-2946' class="function">write_history_file</tt></b>(</nobr></td>
119 <td><var></var><big>[</big><var>filename</var><big>]</big><var></var>)</td></tr></table></dt>
120<dd>
121Save a readline history file.
122The default filename is <span class="file">~/.history</span>.
123</dl>
124
125<P>
126<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
127 <td><nobr><b><tt id='l2h-2947' xml:id='l2h-2947' class="function">clear_history</tt></b>(</nobr></td>
128 <td><var></var>)</td></tr></table></dt>
129<dd>
130Clear the current history. (Note: this function is not available if
131the installed version of GNU readline doesn't support it.)
132
133<span class="versionnote">New in version 2.4.</span>
134
135</dl>
136
137<P>
138<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
139 <td><nobr><b><tt id='l2h-2948' xml:id='l2h-2948' class="function">get_history_length</tt></b>(</nobr></td>
140 <td><var></var>)</td></tr></table></dt>
141<dd>
142Return the desired length of the history file. Negative values imply
143unlimited history file size.
144</dl>
145
146<P>
147<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
148 <td><nobr><b><tt id='l2h-2949' xml:id='l2h-2949' class="function">set_history_length</tt></b>(</nobr></td>
149 <td><var>length</var>)</td></tr></table></dt>
150<dd>
151Set the number of lines to save in the history file.
152<tt class="function">write_history_file()</tt> uses this value to truncate the
153history file when saving. Negative values imply unlimited history
154file size.
155</dl>
156
157<P>
158<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
159 <td><nobr><b><tt id='l2h-2950' xml:id='l2h-2950' class="function">get_current_history_length</tt></b>(</nobr></td>
160 <td><var></var>)</td></tr></table></dt>
161<dd>
162Return the number of lines currently in the history. (This is different
163from <tt class="function">get_history_length()</tt>, which returns the maximum number of
164lines that will be written to a history file.)
165<span class="versionnote">New in version 2.3.</span>
166
167</dl>
168
169<P>
170<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
171 <td><nobr><b><tt id='l2h-2951' xml:id='l2h-2951' class="function">get_history_item</tt></b>(</nobr></td>
172 <td><var>index</var>)</td></tr></table></dt>
173<dd>
174Return the current contents of history item at <var>index</var>.
175
176<span class="versionnote">New in version 2.3.</span>
177
178</dl>
179
180<P>
181<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
182 <td><nobr><b><tt id='l2h-2952' xml:id='l2h-2952' class="function">remove_history_item</tt></b>(</nobr></td>
183 <td><var>pos</var>)</td></tr></table></dt>
184<dd>
185Remove history item specified by its position from the history.
186
187<span class="versionnote">New in version 2.4.</span>
188
189</dl>
190
191<P>
192<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
193 <td><nobr><b><tt id='l2h-2953' xml:id='l2h-2953' class="function">replace_history_item</tt></b>(</nobr></td>
194 <td><var>pos, line</var>)</td></tr></table></dt>
195<dd>
196Replace history item specified by its position with the given line.
197
198<span class="versionnote">New in version 2.4.</span>
199
200</dl>
201
202<P>
203<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
204 <td><nobr><b><tt id='l2h-2954' xml:id='l2h-2954' class="function">redisplay</tt></b>(</nobr></td>
205 <td><var></var>)</td></tr></table></dt>
206<dd>
207Change what's displayed on the screen to reflect the current contents
208of the line buffer.
209<span class="versionnote">New in version 2.3.</span>
210
211</dl>
212
213<P>
214<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
215 <td><nobr><b><tt id='l2h-2955' xml:id='l2h-2955' class="function">set_startup_hook</tt></b>(</nobr></td>
216 <td><var></var><big>[</big><var>function</var><big>]</big><var></var>)</td></tr></table></dt>
217<dd>
218Set or remove the startup_hook function. If <var>function</var> is specified,
219it will be used as the new startup_hook function; if omitted or
220<code>None</code>, any hook function already installed is removed. The
221startup_hook function is called with no arguments just
222before readline prints the first prompt.
223</dl>
224
225<P>
226<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
227 <td><nobr><b><tt id='l2h-2956' xml:id='l2h-2956' class="function">set_pre_input_hook</tt></b>(</nobr></td>
228 <td><var></var><big>[</big><var>function</var><big>]</big><var></var>)</td></tr></table></dt>
229<dd>
230Set or remove the pre_input_hook function. If <var>function</var> is specified,
231it will be used as the new pre_input_hook function; if omitted or
232<code>None</code>, any hook function already installed is removed. The
233pre_input_hook function is called with no arguments after the first prompt
234has been printed and just before readline starts reading input characters.
235</dl>
236
237<P>
238<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
239 <td><nobr><b><tt id='l2h-2957' xml:id='l2h-2957' class="function">set_completer</tt></b>(</nobr></td>
240 <td><var></var><big>[</big><var>function</var><big>]</big><var></var>)</td></tr></table></dt>
241<dd>
242Set or remove the completer function. If <var>function</var> is specified,
243it will be used as the new completer function; if omitted or
244<code>None</code>, any completer function already installed is removed. The
245completer function is called as <code><var>function</var>(<var>text</var>,
246<var>state</var>)</code>, for <var>state</var> in <code>0</code>, <code>1</code>, <code>2</code>, ...,
247until it returns a non-string value. It should return the next
248possible completion starting with <var>text</var>.
249</dl>
250
251<P>
252<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
253 <td><nobr><b><tt id='l2h-2958' xml:id='l2h-2958' class="function">get_completer</tt></b>(</nobr></td>
254 <td><var></var>)</td></tr></table></dt>
255<dd>
256Get the completer function, or <code>None</code> if no completer function
257has been set.
258<span class="versionnote">New in version 2.3.</span>
259
260</dl>
261
262<P>
263<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
264 <td><nobr><b><tt id='l2h-2959' xml:id='l2h-2959' class="function">get_begidx</tt></b>(</nobr></td>
265 <td><var></var>)</td></tr></table></dt>
266<dd>
267Get the beginning index of the readline tab-completion scope.
268</dl>
269
270<P>
271<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
272 <td><nobr><b><tt id='l2h-2960' xml:id='l2h-2960' class="function">get_endidx</tt></b>(</nobr></td>
273 <td><var></var>)</td></tr></table></dt>
274<dd>
275Get the ending index of the readline tab-completion scope.
276</dl>
277
278<P>
279<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
280 <td><nobr><b><tt id='l2h-2961' xml:id='l2h-2961' class="function">set_completer_delims</tt></b>(</nobr></td>
281 <td><var>string</var>)</td></tr></table></dt>
282<dd>
283Set the readline word delimiters for tab-completion.
284</dl>
285
286<P>
287<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
288 <td><nobr><b><tt id='l2h-2962' xml:id='l2h-2962' class="function">get_completer_delims</tt></b>(</nobr></td>
289 <td><var></var>)</td></tr></table></dt>
290<dd>
291Get the readline word delimiters for tab-completion.
292</dl>
293
294<P>
295<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
296 <td><nobr><b><tt id='l2h-2963' xml:id='l2h-2963' class="function">add_history</tt></b>(</nobr></td>
297 <td><var>line</var>)</td></tr></table></dt>
298<dd>
299Append a line to the history buffer, as if it was the last line typed.
300</dl>
301
302<P>
303<div class="seealso">
304 <p class="heading">See Also:</p>
305
306 <dl compact="compact" class="seemodule">
307 <dt>Module <b><tt class="module"><a href="module-rlcompleter.html">rlcompleter</a></tt>:</b>
308 <dd>Completion of Python identifiers at the
309 interactive prompt.
310 </dl>
311</div>
312
313<P>
314
315<p><br /></p><hr class='online-navigation' />
316<div class='online-navigation'>
317<!--Table of Child-Links-->
318<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
319
320<UL CLASS="ChildLinks">
321<LI><A href="readline-example.html">7.20.1 Example</a>
322</ul>
323<!--End of Table of Child-Links-->
324</div>
325
326<DIV CLASS="navigation">
327<div class='online-navigation'>
328<p></p><hr />
329<table align="center" width="100%" cellpadding="0" cellspacing="2">
330<tr>
331<td class='online-navigation'><a rel="prev" title="7.19.3 Examples"
332 href="tar-examples.html"><img src='../icons/previous.png'
333 border='0' height='32' alt='Previous Page' width='32' /></A></td>
334<td class='online-navigation'><a rel="parent" title="7. Optional Operating System"
335 href="someos.html"><img src='../icons/up.png'
336 border='0' height='32' alt='Up One Level' width='32' /></A></td>
337<td class='online-navigation'><a rel="next" title="7.20.1 Example"
338 href="readline-example.html"><img src='../icons/next.png'
339 border='0' height='32' alt='Next Page' width='32' /></A></td>
340<td align="center" width="100%">Python Library Reference</td>
341<td class='online-navigation'><a rel="contents" title="Table of Contents"
342 href="contents.html"><img src='../icons/contents.png'
343 border='0' height='32' alt='Contents' width='32' /></A></td>
344<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
345 border='0' height='32' alt='Module Index' width='32' /></a></td>
346<td class='online-navigation'><a rel="index" title="Index"
347 href="genindex.html"><img src='../icons/index.png'
348 border='0' height='32' alt='Index' width='32' /></A></td>
349</tr></table>
350<div class='online-navigation'>
351<b class="navlabel">Previous:</b>
352<a class="sectref" rel="prev" href="tar-examples.html">7.19.3 Examples</A>
353<b class="navlabel">Up:</b>
354<a class="sectref" rel="parent" href="someos.html">7. Optional Operating System</A>
355<b class="navlabel">Next:</b>
356<a class="sectref" rel="next" href="readline-example.html">7.20.1 Example</A>
357</div>
358</div>
359<hr />
360<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
361</DIV>
362<!--End of Navigation Panel-->
363<ADDRESS>
364See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
365</ADDRESS>
366</BODY>
367</HTML>