Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / writer-interface.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="writer-impls.html" />
<link rel="prev" href="formatter-impls.html" />
<link rel="parent" href="module-formatter.html" />
<link rel="next" href="writer-impls.html" />
<meta name='aesop' content='information' />
<title>12.1.3 The Writer Interface </title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="12.1.2 Formatter Implementations"
href="formatter-impls.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="12.1 formatter "
href="module-formatter.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="12.1.4 Writer Implementations"
href="writer-impls.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="formatter-impls.html">12.1.2 Formatter Implementations</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-formatter.html">12.1 formatter </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="writer-impls.html">12.1.4 Writer Implementations</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION0014130000000000000000"></A><A NAME="writer-interface"></A>
<BR>
12.1.3 The Writer Interface
</H2>
<P>
Interfaces to create writers are dependent on the specific writer
class being instantiated. The interfaces described below are the
required interfaces which all writers must support once initialized.
Note that while most applications can use the
<tt class="class">AbstractFormatter</tt> class as a formatter, the writer must
typically be provided by the application.
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3812' xml:id='l2h-3812' class="method">flush</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Flush any buffered output or device control events.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3813' xml:id='l2h-3813' class="method">new_alignment</tt></b>(</nobr></td>
<td><var>align</var>)</td></tr></table></dt>
<dd>
Set the alignment style. The <var>align</var> value can be any object,
but by convention is a string or <code>None</code>, where <code>None</code>
indicates that the writer's ``preferred'' alignment should be used.
Conventional <var>align</var> values are <code>'left'</code>, <code>'center'</code>,
<code>'right'</code>, and <code>'justify'</code>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3814' xml:id='l2h-3814' class="method">new_font</tt></b>(</nobr></td>
<td><var>font</var>)</td></tr></table></dt>
<dd>
Set the font style. The value of <var>font</var> will be <code>None</code>,
indicating that the device's default font should be used, or a tuple
of the form <code>(</code><var>size</var>, <var>italic</var>, <var>bold</var>,
<var>teletype</var><code>)</code>. Size will be a string indicating the size of
font that should be used; specific strings and their interpretation
must be defined by the application. The <var>italic</var>, <var>bold</var>, and
<var>teletype</var> values are Boolean values specifying which of those
font attributes should be used.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3815' xml:id='l2h-3815' class="method">new_margin</tt></b>(</nobr></td>
<td><var>margin, level</var>)</td></tr></table></dt>
<dd>
Set the margin level to the integer <var>level</var> and the logical tag
to <var>margin</var>. Interpretation of the logical tag is at the
writer's discretion; the only restriction on the value of the logical
tag is that it not be a false value for non-zero values of
<var>level</var>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3816' xml:id='l2h-3816' class="method">new_spacing</tt></b>(</nobr></td>
<td><var>spacing</var>)</td></tr></table></dt>
<dd>
Set the spacing style to <var>spacing</var>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3817' xml:id='l2h-3817' class="method">new_styles</tt></b>(</nobr></td>
<td><var>styles</var>)</td></tr></table></dt>
<dd>
Set additional styles. The <var>styles</var> value is a tuple of
arbitrary values; the value <tt class="constant">AS_IS</tt> should be ignored. The
<var>styles</var> tuple may be interpreted either as a set or as a stack
depending on the requirements of the application and writer
implementation.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3818' xml:id='l2h-3818' class="method">send_line_break</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Break the current line.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3819' xml:id='l2h-3819' class="method">send_paragraph</tt></b>(</nobr></td>
<td><var>blankline</var>)</td></tr></table></dt>
<dd>
Produce a paragraph separation of at least <var>blankline</var> blank
lines, or the equivalent. The <var>blankline</var> value will be an
integer. Note that the implementation will receive a call to
<tt class="method">send_line_break()</tt> before this call if a line break is needed;
this method should not include ending the last line of the paragraph.
It is only responsible for vertical spacing between paragraphs.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3820' xml:id='l2h-3820' class="method">send_hor_rule</tt></b>(</nobr></td>
<td><var>*args, **kw</var>)</td></tr></table></dt>
<dd>
Display a horizontal rule on the output device. The arguments to this
method are entirely application- and writer-specific, and should be
interpreted with care. The method implementation may assume that a
line break has already been issued via <tt class="method">send_line_break()</tt>.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3821' xml:id='l2h-3821' class="method">send_flowing_data</tt></b>(</nobr></td>
<td><var>data</var>)</td></tr></table></dt>
<dd>
Output character data which may be word-wrapped and re-flowed as
needed. Within any sequence of calls to this method, the writer may
assume that spans of multiple whitespace characters have been
collapsed to single space characters.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3822' xml:id='l2h-3822' class="method">send_literal_data</tt></b>(</nobr></td>
<td><var>data</var>)</td></tr></table></dt>
<dd>
Output character data which has already been formatted
for display. Generally, this should be interpreted to mean that line
breaks indicated by newline characters should be preserved and no new
line breaks should be introduced. The data may contain embedded
newline and tab characters, unlike data provided to the
<tt class="method">send_formatted_data()</tt> interface.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3823' xml:id='l2h-3823' class="method">send_label_data</tt></b>(</nobr></td>
<td><var>data</var>)</td></tr></table></dt>
<dd>
Set <var>data</var> to the left of the current left margin, if possible.
The value of <var>data</var> is not restricted; treatment of non-string
values is entirely application- and writer-dependent. This method
will only be called at the beginning of a line.
</dl>
<P>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="12.1.2 Formatter Implementations"
href="formatter-impls.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="12.1 formatter "
href="module-formatter.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="12.1.4 Writer Implementations"
href="writer-impls.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="formatter-impls.html">12.1.2 Formatter Implementations</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-formatter.html">12.1 formatter </A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="writer-impls.html">12.1.4 Writer Implementations</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>