Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > cd14cddf3b3ceaf1193157472227757a > files > 328

parrot-doc-1.6.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Parrot  - resizable array for strings only</title>
        <link rel="stylesheet" type="text/css"
            href="../../../resources/parrot.css"
            media="all">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    </head>
    <body>
        <div id="wrapper">
            <div id="header">

                <a href="http://www.parrot.org">
                <img border=0 src="../../../resources/parrot_logo.png" id="logo" alt="parrot">
                </a>
            </div> <!-- "header" -->
            <div id="divider"></div>
            <div id="mainbody">
                <div id="breadcrumb">
                    <a href="../../../html/index.html">Home</a> &raquo; <a href="../../../html/pmc.html">PMCs</a> &raquo; resizable array for strings only
                </div>

<h1><a name="NAME"
>NAME</a></h1>

<p>src/pmc/resizablestringarray.pmc &#45; resizable array for strings only</p>

<h1><a name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>ResizableStringArray implements a resizeable array which stores Parrot strings only.
Any ints or floats assigned to elements of the array will first be converted to String PMCs and then to native Parrot strings.
PMCs assigned to to elements of the array will be stringified by having their <code>get_string</code> method called.</p>

<h2><a name="Functions"
>Functions</a></h2>

<dl>
<dt><a name="STRING_*get_string_keyed_int(INTVAL_key)"
><b><code>STRING *get_string_keyed_int(INTVAL key)</b></code></a></dt>
Returns the Parrot string value of the element at index <code>key</code>.
<dt><a name="void_set_string_keyed_int(INTVAL_key,_STRING_*value)"
><b><code>void set_string_keyed_int(INTVAL key, STRING *value)</b></code></a></dt>
Sets the Parrot string value of the element at index <code>key</code> to <code>value</code>.
<dt><a name="void_push_string(STRING_*value)"
><b><code>void push_string(STRING *value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the end of the array.
<dt><a name="STRING_*pop_string()"
><b><code>STRING *pop_string()</b></code></a></dt>
Removes and returns the last element in the array.
<dt><a name="PMC_*pop_pmc()"
><b><code>PMC *pop_pmc()</b></code></a></dt>
Removes and returns the last element in the array.
<dt><a name="INTVAL_pop_integer()"
><b><code>INTVAL pop_integer()</b></code></a></dt>
Removes and returns the last element in the array.
<dt><a name="FLOATVAL_pop_float()"
><b><code>FLOATVAL pop_float()</b></code></a></dt>
Removes and returns the last element in the array.
<dt><a name="void_set_integer_native(INTVAL_size)"
><b><code>void set_integer_native(INTVAL size)</b></code></a></dt>
Resizes the array to <code>size</code> elements.
<dt><a name="PMC_*clone()"
><b><code>PMC *clone()</b></code></a></dt>
Creates and returns a copy of the array.
<dt><a name="STRING_*shift_string()"
><b><code>STRING *shift_string()</b></code></a></dt>
Removes and returns an item from the start of the array.
<dt><a name="PMC_*shift_pmc()"
><b><code>PMC *shift_pmc()</b></code></a></dt>
Removes and returns the first element in the array.
<dt><a name="INTVAL_shift_integer()"
><b><code>INTVAL shift_integer()</b></code></a></dt>
Removes and returns the first element in the array.
<dt><a name="FLOATVAL_shift_float()"
><b><code>FLOATVAL shift_float()</b></code></a></dt>
Removes and returns the first element in the array.
<dt><a name="void_push_pmc(PMC_*value)"
><b><code>void push_pmc(PMC *value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the end of the array.
<dt><a name="void_push_integer(INTVAL_value)"
><b><code>void push_integer(INTVAL value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the end of the array.
<dt><a name="void_push_float(FLOAT_value)"
><b><code>void push_float(FLOAT value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the end of the array.
<dt><a name="PMC_*shift_pmc()"
><b><code>PMC *shift_pmc()</b></code></a></dt>
Removes and returns a String PMC from the start of the array.
<dt><a name="void_unshift_string(STRING_*value)"
><b><code>void unshift_string(STRING *value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the start of the array.
<dt><a name="void_unshift_pmc(PMC_*value)"
><b><code>void unshift_pmc(PMC *value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the front of the array.
<dt><a name="void_unshift_integer(INTVAL_value)"
><b><code>void unshift_integer(INTVAL value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the front of the array.
<dt><a name="void_unshift_float(FLOAT_value)"
><b><code>void unshift_float(FLOAT value)</b></code></a></dt>
Extends the array by adding an element of value <code>*value</code> to the front of the array.
<dt><a name="void_delete_keyed_int(INTVAL_key)"
><b><code>void delete_keyed_int(INTVAL key)</b></code></a></dt>
Converts <code>key</code> to a PMC key and calls <code>delete_keyed()</code> with it.
<dt><a name="void_delete_keyed(PMC_*key)"
><b><code>void delete_keyed(PMC *key)</b></code></a></dt>
Removes the element at <code>*key</code>.
<dt><a name="void_splice(PMC_*value,_INTVAL_offset,_INTVAL_count)"
><b><code>void splice(PMC *value, INTVAL offset, INTVAL count)</b></code></a></dt>
Replaces <code>count</code> elements starting at <code>offset</code> with the elements in <code>value</code>.Note that the <code>value</code> PMC can be of any of the various array types.Note that this implementation can be *VERY *inefficient as it manipulates everything via the VTABLE api.
<dt><a name="METHOD_PMC*_shift()"
>METHOD PMC* shift()</a></dt>

<dt><a name="METHOD_PMC*_pop()"
>METHOD PMC* pop()</a></dt>
Method forms to remove and return a PMC from the beginning or end of the array.
<dt><a name="METHOD_unshift(PMC*_value)"
>METHOD unshift(PMC* value)</a></dt>

<dt><a name="METHOD_push(PMC*_value)"
>METHOD push(PMC* value)</a></dt>
Method forms to add a PMC to the beginning or end of the array.</dl>

<h1><a name="SEE_ALSO"
>SEE ALSO</a></h1>

<p><em>docs/pdds/pdd17_basic_types.pod</em>.</p>

<h1><a name="HISTORY"
>HISTORY</a></h1>

<p>Initial version &#45; Matt Fowles 2004&#45;06&#45;11 Changed allocator to double size &#45; Matt Fowles 2004&#45;06&#45;15 Added push_string &#45; Bernhard Schmalhofer 2004&#45;10&#45;17 moved available size to int_val2 &#45; Matt Fowles 2005&#45;07&#45;22</p>
            </div> <!-- "mainbody" -->
            <div id="divider"></div>
            <div id="footer">
	        Copyright &copy; 2002-2009, Parrot Foundation.
            </div>
        </div> <!-- "wrapper" -->
    </body>
</html>