Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / api / cell-objects.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="api.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="api.html" title='Python/C API Reference Manual' />
<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="gen-objects.html" />
<link rel="prev" href="cObjects.html" />
<link rel="parent" href="otherObjects.html" />
<link rel="next" href="gen-objects.html" />
<meta name='aesop' content='information' />
<title>7.5.10 Cell Objects </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="7.5.9 CObjects"
href="cObjects.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="7.5 Other Objects"
href="otherObjects.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="7.5.11 Generator Objects"
href="gen-objects.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python/C API Reference Manual</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'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></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="cObjects.html">7.5.9 CObjects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="otherObjects.html">7.5 Other Objects</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="gen-objects.html">7.5.11 Generator Objects</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION0095100000000000000000"></A><A NAME="cell-objects"></A>
<BR>
7.5.10 Cell Objects
</H2>
<P>
``Cell'' objects are used to implement variables referenced by
multiple scopes. For each such variable, a cell object is created to
store the value; the local variables of each stack frame that
references the value contains a reference to the cells from outer
scopes which also use that variable. When the value is accessed, the
value contained in the cell is used instead of the cell object
itself. This de-referencing of the cell object requires support from
the generated byte-code; these are not automatically de-referenced
when accessed. Cell objects are not likely to be useful elsewhere.
<P>
<dl><dt><b><tt class="ctype"><a id='l2h-733' xml:id='l2h-733'>PyCellObject</a></tt></b></dt>
<dd>
The C structure used for cell objects.
</dl>
<P>
<dl><dt>PyTypeObject <b><tt id='l2h-734' xml:id='l2h-734' class="cdata">PyCell_Type</tt></b></dt>
<dd>
The type object corresponding to cell objects
</dd></dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int&nbsp;<b><tt id='l2h-735' xml:id='l2h-735' class="cfunction">PyCell_Check</tt></b>(</nobr></td><td>ob)</td></tr></table></dt>
<dd>
Return true if <var>ob</var> is a cell object; <var>ob</var> must not be
<tt class="constant">NULL</tt>.
</dd></dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>PyObject*&nbsp;<b><tt id='l2h-736' xml:id='l2h-736' class="cfunction">PyCell_New</tt></b>(</nobr></td><td>PyObject *<var>ob</var>)</td></tr></table></dt>
<dd>
<div class="refcount-info">
<span class="label">Return value:</span>
<span class="value">New reference.</span>
</div>
Create and return a new cell object containing the value <var>ob</var>.
The parameter may be <tt class="constant">NULL</tt>.
</dd></dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>PyObject*&nbsp;<b><tt id='l2h-737' xml:id='l2h-737' class="cfunction">PyCell_Get</tt></b>(</nobr></td><td>PyObject *<var>cell</var>)</td></tr></table></dt>
<dd>
<div class="refcount-info">
<span class="label">Return value:</span>
<span class="value">New reference.</span>
</div>
Return the contents of the cell <var>cell</var>.
</dd></dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>PyObject*&nbsp;<b><tt id='l2h-738' xml:id='l2h-738' class="cfunction">PyCell_GET</tt></b>(</nobr></td><td>PyObject *<var>cell</var>)</td></tr></table></dt>
<dd>
<div class="refcount-info">
<span class="label">Return value:</span>
<span class="value">Borrowed reference.</span>
</div>
Return the contents of the cell <var>cell</var>, but without checking
that <var>cell</var> is non-<tt class="constant">NULL</tt> and a cell object.
</dd></dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>int&nbsp;<b><tt id='l2h-739' xml:id='l2h-739' class="cfunction">PyCell_Set</tt></b>(</nobr></td><td>PyObject *<var>cell</var>, PyObject *<var>value</var>)</td></tr></table></dt>
<dd>
Set the contents of the cell object <var>cell</var> to <var>value</var>. This
releases the reference to any current content of the cell.
<var>value</var> may be <tt class="constant">NULL</tt>. <var>cell</var> must be non-<tt class="constant">NULL</tt>; if it is
not a cell object, <code>-1</code> will be returned. On success, <code>0</code>
will be returned.
</dd></dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"><td><nobr>void&nbsp;<b><tt id='l2h-740' xml:id='l2h-740' class="cfunction">PyCell_SET</tt></b>(</nobr></td><td>PyObject *<var>cell</var>, PyObject *<var>value</var>)</td></tr></table></dt>
<dd>
Sets the value of the cell object <var>cell</var> to <var>value</var>. No
reference counts are adjusted, and no checks are made for safety;
<var>cell</var> must be non-<tt class="constant">NULL</tt> and must be a cell object.
</dd></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="7.5.9 CObjects"
href="cObjects.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="7.5 Other Objects"
href="otherObjects.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="7.5.11 Generator Objects"
href="gen-objects.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python/C API Reference Manual</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'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></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="cObjects.html">7.5.9 CObjects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="otherObjects.html">7.5 Other Objects</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="gen-objects.html">7.5.11 Generator Objects</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>