Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / html / python / lib / writer-interface.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="writer-impls.html" />
13<link rel="prev" href="formatter-impls.html" />
14<link rel="parent" href="module-formatter.html" />
15<link rel="next" href="writer-impls.html" />
16<meta name='aesop' content='information' />
17<title>12.1.3 The Writer 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="12.1.2 Formatter Implementations"
25 href="formatter-impls.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="12.1 formatter "
28 href="module-formatter.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="12.1.4 Writer Implementations"
31 href="writer-impls.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="formatter-impls.html">12.1.2 Formatter Implementations</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-formatter.html">12.1 formatter </A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="writer-impls.html">12.1.4 Writer Implementations</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION0014130000000000000000"></A><A NAME="writer-interface"></A>
56<BR>
5712.1.3 The Writer Interface
58</H2>
59
60<P>
61Interfaces to create writers are dependent on the specific writer
62class being instantiated. The interfaces described below are the
63required interfaces which all writers must support once initialized.
64Note that while most applications can use the
65<tt class="class">AbstractFormatter</tt> class as a formatter, the writer must
66typically be provided by the application.
67
68<P>
69<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
70 <td><nobr><b><tt id='l2h-3812' xml:id='l2h-3812' class="method">flush</tt></b>(</nobr></td>
71 <td><var></var>)</td></tr></table></dt>
72<dd>
73Flush any buffered output or device control events.
74</dl>
75
76<P>
77<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
78 <td><nobr><b><tt id='l2h-3813' xml:id='l2h-3813' class="method">new_alignment</tt></b>(</nobr></td>
79 <td><var>align</var>)</td></tr></table></dt>
80<dd>
81Set the alignment style. The <var>align</var> value can be any object,
82but by convention is a string or <code>None</code>, where <code>None</code>
83indicates that the writer's ``preferred'' alignment should be used.
84Conventional <var>align</var> values are <code>'left'</code>, <code>'center'</code>,
85<code>'right'</code>, and <code>'justify'</code>.
86</dl>
87
88<P>
89<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
90 <td><nobr><b><tt id='l2h-3814' xml:id='l2h-3814' class="method">new_font</tt></b>(</nobr></td>
91 <td><var>font</var>)</td></tr></table></dt>
92<dd>
93Set the font style. The value of <var>font</var> will be <code>None</code>,
94indicating that the device's default font should be used, or a tuple
95of the form <code>(</code><var>size</var>, <var>italic</var>, <var>bold</var>,
96<var>teletype</var><code>)</code>. Size will be a string indicating the size of
97font that should be used; specific strings and their interpretation
98must be defined by the application. The <var>italic</var>, <var>bold</var>, and
99<var>teletype</var> values are Boolean values specifying which of those
100font attributes should be used.
101</dl>
102
103<P>
104<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
105 <td><nobr><b><tt id='l2h-3815' xml:id='l2h-3815' class="method">new_margin</tt></b>(</nobr></td>
106 <td><var>margin, level</var>)</td></tr></table></dt>
107<dd>
108Set the margin level to the integer <var>level</var> and the logical tag
109to <var>margin</var>. Interpretation of the logical tag is at the
110writer's discretion; the only restriction on the value of the logical
111tag is that it not be a false value for non-zero values of
112<var>level</var>.
113</dl>
114
115<P>
116<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
117 <td><nobr><b><tt id='l2h-3816' xml:id='l2h-3816' class="method">new_spacing</tt></b>(</nobr></td>
118 <td><var>spacing</var>)</td></tr></table></dt>
119<dd>
120Set the spacing style to <var>spacing</var>.
121</dl>
122
123<P>
124<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
125 <td><nobr><b><tt id='l2h-3817' xml:id='l2h-3817' class="method">new_styles</tt></b>(</nobr></td>
126 <td><var>styles</var>)</td></tr></table></dt>
127<dd>
128Set additional styles. The <var>styles</var> value is a tuple of
129arbitrary values; the value <tt class="constant">AS_IS</tt> should be ignored. The
130<var>styles</var> tuple may be interpreted either as a set or as a stack
131depending on the requirements of the application and writer
132implementation.
133</dl>
134
135<P>
136<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
137 <td><nobr><b><tt id='l2h-3818' xml:id='l2h-3818' class="method">send_line_break</tt></b>(</nobr></td>
138 <td><var></var>)</td></tr></table></dt>
139<dd>
140Break the current line.
141</dl>
142
143<P>
144<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
145 <td><nobr><b><tt id='l2h-3819' xml:id='l2h-3819' class="method">send_paragraph</tt></b>(</nobr></td>
146 <td><var>blankline</var>)</td></tr></table></dt>
147<dd>
148Produce a paragraph separation of at least <var>blankline</var> blank
149lines, or the equivalent. The <var>blankline</var> value will be an
150integer. Note that the implementation will receive a call to
151<tt class="method">send_line_break()</tt> before this call if a line break is needed;
152this method should not include ending the last line of the paragraph.
153It is only responsible for vertical spacing between paragraphs.
154</dl>
155
156<P>
157<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
158 <td><nobr><b><tt id='l2h-3820' xml:id='l2h-3820' class="method">send_hor_rule</tt></b>(</nobr></td>
159 <td><var>*args, **kw</var>)</td></tr></table></dt>
160<dd>
161Display a horizontal rule on the output device. The arguments to this
162method are entirely application- and writer-specific, and should be
163interpreted with care. The method implementation may assume that a
164line break has already been issued via <tt class="method">send_line_break()</tt>.
165</dl>
166
167<P>
168<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
169 <td><nobr><b><tt id='l2h-3821' xml:id='l2h-3821' class="method">send_flowing_data</tt></b>(</nobr></td>
170 <td><var>data</var>)</td></tr></table></dt>
171<dd>
172Output character data which may be word-wrapped and re-flowed as
173needed. Within any sequence of calls to this method, the writer may
174assume that spans of multiple whitespace characters have been
175collapsed to single space characters.
176</dl>
177
178<P>
179<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
180 <td><nobr><b><tt id='l2h-3822' xml:id='l2h-3822' class="method">send_literal_data</tt></b>(</nobr></td>
181 <td><var>data</var>)</td></tr></table></dt>
182<dd>
183Output character data which has already been formatted
184for display. Generally, this should be interpreted to mean that line
185breaks indicated by newline characters should be preserved and no new
186line breaks should be introduced. The data may contain embedded
187newline and tab characters, unlike data provided to the
188<tt class="method">send_formatted_data()</tt> interface.
189</dl>
190
191<P>
192<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
193 <td><nobr><b><tt id='l2h-3823' xml:id='l2h-3823' class="method">send_label_data</tt></b>(</nobr></td>
194 <td><var>data</var>)</td></tr></table></dt>
195<dd>
196Set <var>data</var> to the left of the current left margin, if possible.
197The value of <var>data</var> is not restricted; treatment of non-string
198values is entirely application- and writer-dependent. This method
199will only be called at the beginning of a line.
200</dl>
201
202<P>
203
204<DIV CLASS="navigation">
205<div class='online-navigation'>
206<p></p><hr />
207<table align="center" width="100%" cellpadding="0" cellspacing="2">
208<tr>
209<td class='online-navigation'><a rel="prev" title="12.1.2 Formatter Implementations"
210 href="formatter-impls.html"><img src='../icons/previous.png'
211 border='0' height='32' alt='Previous Page' width='32' /></A></td>
212<td class='online-navigation'><a rel="parent" title="12.1 formatter "
213 href="module-formatter.html"><img src='../icons/up.png'
214 border='0' height='32' alt='Up One Level' width='32' /></A></td>
215<td class='online-navigation'><a rel="next" title="12.1.4 Writer Implementations"
216 href="writer-impls.html"><img src='../icons/next.png'
217 border='0' height='32' alt='Next Page' width='32' /></A></td>
218<td align="center" width="100%">Python Library Reference</td>
219<td class='online-navigation'><a rel="contents" title="Table of Contents"
220 href="contents.html"><img src='../icons/contents.png'
221 border='0' height='32' alt='Contents' width='32' /></A></td>
222<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
223 border='0' height='32' alt='Module Index' width='32' /></a></td>
224<td class='online-navigation'><a rel="index" title="Index"
225 href="genindex.html"><img src='../icons/index.png'
226 border='0' height='32' alt='Index' width='32' /></A></td>
227</tr></table>
228<div class='online-navigation'>
229<b class="navlabel">Previous:</b>
230<a class="sectref" rel="prev" href="formatter-impls.html">12.1.2 Formatter Implementations</A>
231<b class="navlabel">Up:</b>
232<a class="sectref" rel="parent" href="module-formatter.html">12.1 formatter </A>
233<b class="navlabel">Next:</b>
234<a class="sectref" rel="next" href="writer-impls.html">12.1.4 Writer Implementations</A>
235</div>
236</div>
237<hr />
238<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
239</DIV>
240<!--End of Navigation Panel-->
241<ADDRESS>
242See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
243</ADDRESS>
244</BODY>
245</HTML>