<!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 - Array PMC</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> » <a href="../../../html/pmc.html">PMCs</a> » Array PMC </div> <h1><a name="NAME" >NAME</a></h1> <p>src/pmc/array.pmc - Array PMC</p> <h1><a name="DESCRIPTION" >DESCRIPTION</a></h1> <p>These are the vtable functions for the Array base class.</p> <h2><a name="Functions" >Functions</a></h2> <dl> <dt><a name="static_PMC_*undef(PARROT_INTERP)" ><b><code>static PMC *undef(PARROT_INTERP)</b></code></a></dt> Returns a <code>Undef</code> PMC. <dt><a name="static_PMC_*retval(PARROT_INTERP,_void_*ret)" ><b><code>static PMC *retval(PARROT_INTERP, void *ret)</b></code></a></dt> Processes <code>*ret</code>, returning the appropriate PMC, or raising an exception if necessary. <dt><a name="static_PMC_*Parrot_Array_set_pmc_ptr(PARROT_INTERP,_List_*list,_INTVAL_key)" ><b><code>static PMC *Parrot_Array_set_pmc_ptr(PARROT_INTERP, List *list, INTVAL key)</b></code></a></dt> Returns a pointer to the element at index <code>key</code> of <code>*list</code>. If this element was previously empty, then this function also creates and assigns an "undef" PMC to that element.</dl> <h2><a name="Methods" >Methods</a></h2> <dl> <dt><a name="void_init()" ><b><code>void init()</b></code></a></dt> Initializes the PMC by calling the underlying <code>list_new()</code> function. <dt><a name="void_init_pmc(PMC_*init)" ><b><code>void init_pmc(PMC *init)</b></code></a></dt> <code>*init</code> contains the initialization information specifying initial size, number of dimensions, etc. <dt><a name="void_assign_pmc(PMC_*other)" ><b><code>void assign_pmc(PMC *other)</b></code></a></dt> Copy the contents of other to self. <dt><a name="void_set_pmc(PMC_*other)" ><b><code>void set_pmc(PMC *other)</b></code></a></dt> Implemented as an alias to <code>assign_pmc</code> since the behavior is the same. <dt><a name="void_mark()" ><b><code>void mark()</b></code></a></dt> Mark the array and its contents as live. <dt><a name="PMC_*clone()" ><b><code>PMC *clone()</b></code></a></dt> Return a clone of the array. <dt><a name="INTVAL_get_integer()" ><b><code>INTVAL get_integer()</b></code></a></dt> Returns the number of elements in the array. <dt><a name="INTVAL_get_bool()" ><b><code>INTVAL get_bool()</b></code></a></dt> Returns true if the array has one or more elements. <dt><a name="INTVAL_elements()" ><b><code>INTVAL elements()</b></code></a></dt> Returns the number of elements in the array. <dt><a name="FLOATVAL_get_number()" ><b><code>FLOATVAL get_number()</b></code></a></dt> Returns the number of elements in the array. <dt><a name="STRING_*get_string()" ><b><code>STRING *get_string()</b></code></a></dt> Returns a string representation of the array. <dt><a name="INTVAL_get_integer_keyed_int(INTVAL_key)" ><b><code>INTVAL get_integer_keyed_int(INTVAL key)</b></code></a></dt> Returns the integer value of the element at index <code>key</code>. <dt><a name="INTVAL_get_integer_keyed(PMC_*key)" ><b><code>INTVAL get_integer_keyed(PMC *key)</b></code></a></dt> Returns the integer value of the element at index <code>key</code>. <dt><a name="FLOATVAL_get_number_keyed_int(INTVAL_key)" ><b><code>FLOATVAL get_number_keyed_int(INTVAL key)</b></code></a></dt> Returns the float value of the element at index <code>key</code>. <dt><a name="FLOATVAL_get_number_keyed(PMC_*key)" ><b><code>FLOATVAL get_number_keyed(PMC *key)</b></code></a></dt> Returns the float value of the element at index <code>key</code>. <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 string value of the element at index <code>key</code>. <dt><a name="STRING_*get_string_keyed(PMC_*key)" ><b><code>STRING *get_string_keyed(PMC *key)</b></code></a></dt> Returns the string value of the element at index <code>key</code>. <dt><a name="PMC_*get_pmc_keyed_int(INTVAL_key)" ><b><code>PMC *get_pmc_keyed_int(INTVAL key)</b></code></a></dt> Returns the PMC value of the element at index <code>key</code>. <dt><a name="PMC_*get_pmc_keyed(PMC_*key)" ><b><code>PMC *get_pmc_keyed(PMC *key)</b></code></a></dt> Returns the PMC value of the element at index <code>key</code>. <dt><a name="void_set_integer_native(INTVAL_size)" ><b><code>void set_integer_native(INTVAL size)</b></code></a></dt> Sets the length of the array to <code>size</code>. <dt><a name="void_set_integer_same(PMC_*value)" ><b><code>void set_integer_same(PMC *value)</b></code></a></dt> Sets the length of the array to the number of elements in <code>*value</code>. <dt><a name="void_set_integer_keyed_int(INTVAL_key,_INTVAL_value)" ><b><code>void set_integer_keyed_int(INTVAL key, INTVAL value)</b></code></a></dt> Sets the integer value of the PMC at element <code>key</code> to <code>value</code>. <dt><a name="void_set_integer_keyed(PMC_*key,_INTVAL_value)" ><b><code>void set_integer_keyed(PMC *key, INTVAL value)</b></code></a></dt> Sets the integer value of the PMC at element <code>key</code> to <code>value</code>. <dt><a name="void_set_number_keyed_int(INTVAL_key,_FLOATVAL_value)" ><b><code>void set_number_keyed_int(INTVAL key, FLOATVAL value)</b></code></a></dt> Sets the numeric value of the PMC at element <code>key</code> to <code>value</code>. <dt><a name="void_set_number_keyed(PMC_*key,_FLOATVAL_value)" ><b><code>void set_number_keyed(PMC *key, FLOATVAL value)</b></code></a></dt> Sets the numeric value of the PMC at element <code>key</code> to <code>value</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 string value of the PMC at element <code>key</code> to <code>value</code>. <dt><a name="void_set_string_keyed(PMC_*key,_STRING_*value)" ><b><code>void set_string_keyed(PMC *key, STRING *value)</b></code></a></dt> Sets the string value of the PMC at element <code>key</code> to <code>value</code>. <dt><a name="void_set_pmc_keyed_int(INTVAL_idx,_PMC_*src)" ><b><code>void set_pmc_keyed_int(INTVAL idx, PMC *src)</b></code></a></dt> Sets the PMC at element <code>idx</code> to <code>*src</code>. <dt><a name="void_set_pmc_keyed(PMC_*key,_PMC_*value)" ><b><code>void set_pmc_keyed(PMC *key, PMC *value)</b></code></a></dt> Sets the PMC at index <code>key</code> to <code>value</code>. <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(FLOATVAL_value)" ><b><code>void push_float(FLOATVAL 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_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="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_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 start of the array. <dt><a name="void_unshift_float(FLOATVAL_value)" ><b><code>void unshift_float(FLOATVAL 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_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 start of the array. <dt><a name="INTVAL_pop_integer()" ><b><code>INTVAL pop_integer()</b></code></a></dt> Removes and returns an integer from the end of the array. <dt><a name="FLOATVAL_pop_float()" ><b><code>FLOATVAL pop_float()</b></code></a></dt> Removes and returns a float value from the end of the array. <dt><a name="STRING_*pop_string()" ><b><code>STRING *pop_string()</b></code></a></dt> Removes and returns a string from the end of the array. <dt><a name="PMC_*pop_pmc()" ><b><code>PMC *pop_pmc()</b></code></a></dt> Removes and returns a PMC from the end of the array. <dt><a name="INTVAL_shift_integer()" ><b><code>INTVAL shift_integer()</b></code></a></dt> Removes and returns an integer from the start of the array. <dt><a name="FLOATVAL_shift_float()" ><b><code>FLOATVAL shift_float()</b></code></a></dt> Removes and returns a float from the start of the array. <dt><a name="STRING_*shift_string()" ><b><code>STRING *shift_string()</b></code></a></dt> Removes and returns a string from the start of the array. <dt><a name="PMC_*shift_pmc()" ><b><code>PMC *shift_pmc()</b></code></a></dt> Removes and returns a PMC from the start of the array. <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>.If <code>count</code> is 0 then the elements in <code>value</code> will be inserted after <code>offset</code>. <dt><a name="INTVAL_defined_keyed_int(INTVAL_key)" ><b><code>INTVAL defined_keyed_int(INTVAL key)</b></code></a></dt> Returns TRUE is the element at <code>key</code> is defined; otherwise returns false. <dt><a name="INTVAL_defined_keyed(PMC_*key)" ><b><code>INTVAL defined_keyed(PMC *key)</b></code></a></dt> Returns TRUE is the element at <code>key</code> is defined; otherwise returns false. <dt><a name="INTVAL_exists_keyed_int(INTVAL_key)" ><b><code>INTVAL exists_keyed_int(INTVAL key)</b></code></a></dt> Returns TRUE is the element at <code>key</code> exists; otherwise returns false. <dt><a name="INTVAL_exists_keyed(PMC_*key)" ><b><code>INTVAL exists_keyed(PMC *key)</b></code></a></dt> Returns TRUE is the element at <code>key</code> exists; otherwise returns false. <dt><a name="void_delete_keyed_int(INTVAL_key)" ><b><code>void delete_keyed_int(INTVAL key)</b></code></a></dt> Removes the element at <code>key</code>. <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="INTVAL_is_equal(PMC_*value)" ><b><code>INTVAL is_equal(PMC *value)</b></code></a></dt> The <code>==</code> operation. Compares two array to hold equal elements. <dt><a name="PMC_*slice(PMC_*key,_INTVAL_f)" ><b><code>PMC *slice(PMC *key, INTVAL f)</b></code></a></dt> Return a new iterator for the slice PMC <code>key</code> if f == 0.Return a new pythonic array slice if f == 1. <dt><a name="PMC_*get_iter()" ><b><code>PMC *get_iter()</b></code></a></dt> Return a new iterator for SELF. <dt><a name="void_visit(visit_info_*info)" ><b><code>void visit(visit_info *info)</b></code></a></dt> This is used by freeze/thaw to visit the contents of the array.<code>*info</code> is the visit info, (see <em>include/parrot/pmc_freeze.h</em>). <dt><a name="void_freeze(visit_info_*info)" ><b><code>void freeze(visit_info *info)</b></code></a></dt> Used to archive the array. <dt><a name="void_thaw(visit_info_*info)" ><b><code>void thaw(visit_info *info)</b></code></a></dt> Used to unarchive the array. <dt><a name="PMC_*share_ro()" ><b><code>PMC *share_ro()</b></code></a></dt> Recursively make the array read-only and shared.</dl> <h1><a name="SEE_ALSO" >SEE ALSO</a></h1> <p><em><a href="../list.c.html">src/list.c</a></em>, <em>include/parrot/list.h</em></p> <h1><a name="TODO" >TODO</a></h1> <p>Create global immutable undef object.</p> </div> <!-- "mainbody" --> <div id="divider"></div> <div id="footer"> Copyright © 2002-2009, Parrot Foundation. </div> </div> <!-- "wrapper" --> </body> </html>