9699552002-03-12Martin Nilsson <!doctype html><html><head><title>Pike Reference Manual</title> <meta charset='utf-8'></head>
50af352002-07-15Martin Nilsson <body><dl><dt><h1 class='header'>9. Specific Datatype Modules</h1></dt><dd><dl><dt><h2 class='header'>Module <b class='ms datatype'>String</b></h2>
1f918f2002-05-26Martin Nilsson </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>capitalize</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>capitalize</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Convert the first character in <code>str</code> to upper case, and return the new string.</p>
e4e3f32002-04-06Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>lower_case()</code>, <code>upper_case()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>common_prefix</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>common_prefix</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>strs</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Find the longest common prefix from an array of strings.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>expand_tabs</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>expand_tabs</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>tab_width</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_tab</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_space</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>substitute_newline</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Expands tabs in a string to ordinary spaces, according to common tabulation rules.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>fuzzymatch</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int(0..100)</code> <b><span class='method'>fuzzymatch</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This function compares two strings using a fuzzy matching routine. The higher the resulting value, the better the strings match.</p>
e4e3f32002-04-06Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>Array.diff()</code>, <code>Array.diff_compare_table()</code> <code>Array.diff_longest_sequence()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>implode_nicely</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>implode_nicely</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>|<code class='datatype'>int</code>|<code class='datatype'>float</code>) <code class='argument'>foo</code>, <code class='datatype'>string</code>|<code class='datatype'>void</code> <code class='argument'>separator</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This function implodes a list of words to a readable string, e.g. ({"straw","berry","pie"}) becomes "straw, berry and pie". If the separator is omitted, the default is <tt>"and"</tt>. If the words are numbers they are converted to strings first.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>`*()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>int2roman</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>int2roman</span>(</b><code class='datatype'>int</code> <code class='argument'>m</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Converts the provided integer to a roman integer (i.e. a string).</p>
715b8a2002-10-12Martin Nilsson </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>Throws an error if <code>m</code> is outside the range 0 to 10000.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>int2size</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>int2size</span>(</b><code class='datatype'>int</code> <code class='argument'>size</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the size as a memory size string with suffix, e.g. 43210 is converted into "42.2 kb". To be correct to the latest standards it should really read "42.2 KiB", but we have chosen to keep the old notation for a while. The function knows about the quantifiers kilo, mega, giga, tera, peta, exa, zetta and yotta.</p>
715b8a2002-10-12Martin Nilsson </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>Throws an error is <code>size</code> is less than zero.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>sillycaps</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>sillycaps</span>(</b><code class='datatype'>string</code> <code class='argument'>str</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Convert the first character in each word (separated by spaces) in <code>str</code> to upper case, and return the new string.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>soundex</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>soundex</span>(</b><code class='datatype'>string</code> <code class='argument'>word</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the soundex value of <code>word</code> according to the original Soundex algorithm, patented by Margaret O´Dell and Robert C. Russel in 1918. The method is based on the phonetic
715b8a2002-10-12Martin Nilsson  classification of sounds by how they are made. It was only intended for hashing of english surnames, and even at that it isn't that much of a help.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson <dl><dt><h2 class='header'>Class <b class='ms datatype'>String.SplitIterator</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>create</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><span class='object'>String.SplitIterator</span> <span class='class'>String.SplitIterator</span><b>(</b><code class='datatype'>string</code> <code class='argument'>buffer</code>, <code class='datatype'>int</code>|<code class='datatype'>array</code>(<code class='datatype'>int</code>)|<code class='datatype'>multiset</code>(<code class='datatype'>int</code>) <code class='argument'>split_set</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>flags</code>, <code class='datatype'>function</code>(:<code class='datatype'>string</code>)|<code class='datatype'>void</code> <code class='argument'>feed</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson </dl>
50af352002-07-15Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>String.Elite</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>elite_string</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>elite_string</span>(</b><code class='datatype'>string</code> <code class='argument'>in</code>, <code class='datatype'>void</code>|<code class='datatype'>int(0..100)</code> <code class='argument'>leetp</code>, <code class='datatype'>void</code>|<code class='datatype'>bool</code> <code class='argument'>eightbit</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Translates a string to 1337. The optional argument leetp is the maximum percentage of leetness (100=max leet, 0=no leet).</p> <p> The translation is performed in three steps, first the neccesary elite translations (picture -&gt; pic, cool-&gt;kewl etc), then optional translations (ok-&gt;k, dude-&gt;dood, -ers -&gt; -orz), then calls elite_word on the resulting words.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>elite_word</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>elite_word</span>(</b><code class='datatype'>string</code> <code class='argument'>in</code>, <code class='datatype'>void</code>|<code class='datatype'>int(0..100)</code> <code class='argument'>leetp</code>, <code class='datatype'>void</code>|<code class='datatype'>int(0..2)</code> <code class='argument'>eightbit</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Translates one word to 1337. The optional argument leetp is the maximum percentage of leetness (100=max leet, 0=no leet). elite_word only do character-based translation, for instance from "k" to "|&lt;", but no language translation (no "cool" to "kewl").</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>String.HTML</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Functions that helps generating HTML. All functions generates HTML that is XHTML compliant as well as backwards compatible with old HTML standards in what extent is possible.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pad_rows</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <b><span class='method'>pad_rows</span>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <code class='argument'>rows</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Pads out the rows in a array of rows to equal length. The new elements in the rows will have the value provided in <code>padding</code>, or "&amp;nbsp;".</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>select</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>select</span>(</b><code class='datatype'>string</code> <code class='argument'>name</code>, <code class='datatype'>array</code>(<code class='datatype'>string</code>)|<code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <code class='argument'>choices</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>selected</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Creates an HTML select list.</p>
1f918f2002-05-26Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'><span id='p-name'></span>Parameter <code class='parameter'>name</code></dt> <dd></dd><dd class='body--doc'><p>The name of the select list. Will be used in the name attribute of the select element.</p>
1f918f2002-05-26Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'><span id='p-choices'></span>Parameter <code class='parameter'>choices</code></dt> <dd></dd><dd class='body--doc'><p>May either be an array of strings, where each string is a choice, or an array of pairs. A pair is an array with two strings. The first string is the value of the choice while the second string is the presentation text associated with the value.</p> </dd> <dt class='head--doc'><span id='p-selected'></span>Parameter <code class='parameter'>selected</code></dt> <dd></dd><dd class='body--doc'><p>The value that should be selected by default, if any.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>select("language", ({ ({ "eng", "English" }), ({ "swe", "Swedish" }), ({ "nor", "Norwegian" }) }), "swe");</p> </pre></dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>simple_obox</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>simple_obox</span>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>string</code>)) <code class='argument'>rows</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>frame_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>cell_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>width</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This function should solve most of the obox needs that arises. It creates a table out of the array of arrays of strings fed into it. The tables will (with default settings) have a thin black outline around the table and between its cells. Much effort has gone into finding a simple HTML reresentation of such obox that is rendered in a similar way in all popular browsers. The current implementation has been tested against IE, Netscape, Mozilla, Opera and Konquest.</p> </dd> <dt class='head--doc'><span id='p-rows'></span>Parameter <code class='parameter'>rows</code></dt> <dd></dd><dd class='body--doc'><p>Simply an array of arrays with strings. The strings are the values that should appear in the table cells. All rows should have equal number of cells, otherwise the result will not be very eye pleasing.</p> </dd> <dt class='head--doc'><span id='p-frame_color'></span>Parameter <code class='parameter'>frame_color</code></dt> <dd></dd><dd class='body--doc'><p>The color of the surrounding frame. Defaults to "#000000".</p> </dd> <dt class='head--doc'><span id='p-cell_color'></span>Parameter <code class='parameter'>cell_color</code></dt> <dd></dd><dd class='body--doc'><p>The background color of the cells. Defaults to "#ffffff".</p> </dd> <dt class='head--doc'><span id='p-width'></span>Parameter <code class='parameter'>width</code></dt> <dd></dd><dd class='body--doc'><p>The border width. Defaults to "1".</p> </dd> <dt class='head--doc'><span id='p-padding'></span>Parameter <code class='parameter'>padding</code></dt> <dd></dd><dd class='body--doc'><p>The amount of padding in each cell. Defaults to "3".</p> </dd> <dt class='head--doc'><span id='p-cell_callback'></span>Parameter <code class='parameter'>cell_callback</code></dt> <dd></dd><dd class='body--doc'><p>If provided, the cell callback will be called for each cell. As in parameters it will get the current x and y coordinates in the table. The upper left cell is 0,0. In addition to the coordinates it will also recieve the background color and the contents of the current cell. It is expected to return a td-element.</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p>function cb = lambda(int x, int y, string bgcolor, string contents) { if(y%2) return "&lt;td bgcolor='#aaaaff'&gt;"+contents+"&lt;/td&gt;"; return "&lt;td bgcolor='"+bgcolor+"'&gt;"+contents+"&lt;/td&gt;"; } simple_obox(my_rows, "#0000a0", 0, "1", "3", cb);</p> </pre></dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p>pad_rows</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson <dl><dt><h2 class='header'>Class <b class='ms datatype'>String.HTML.OBox</b></h2> </dt><dd><dl class='group--doc'>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Provides the same functionality as the <code>simple_obox</code> function, in a "streaming" way. The real gain is different addtition methods as well as the possibility to change the cell callback at any time.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p>simple_obox</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>add_cell</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_cell</span>(</b><code class='datatype'>string</code> <code class='argument'>contents</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Adds a cell with the provided content.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>add_raw_cell</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_raw_cell</span>(</b><code class='datatype'>string</code> <code class='argument'>cell</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Adds this cell to the table unmodified, e.g. it should have an enclosing td or th element.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>add_row</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_row</span>(</b><code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>cells</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Adds a complete row. If the current row is nonempty a new row will be started.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>add_tagdata_cell</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_tagdata_cell</span>(</b><code class='datatype'>string</code> <code class='argument'>tag</code>, <code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>args</code>, <code class='datatype'>string</code> <code class='argument'>contents</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Creates a cell from the provided arguments and adds it to the table.</p>
1f918f2002-05-26Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'><span id='p-tag'></span>Parameter <code class='parameter'>tag</code></dt> <dd></dd><dd class='body--doc'><p>The name of the element that should be produces. Typically "td" or "th".</p>
1f918f2002-05-26Martin Nilsson </dd> <dt class='head--doc'><span id='p-args'></span>Parameter <code class='parameter'>args</code></dt>
50af352002-07-15Martin Nilsson <dd></dd><dd class='body--doc'><p>A mapping with the elements attributes.</p>
1f918f2002-05-26Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'><span id='p-contents'></span>Parameter <code class='parameter'>contents</code></dt> <dd></dd><dd class='body--doc'><p>The element contents.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>cast</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><b>(</b><span class='datatype'>int</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>float</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>string</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>array</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>mapping</span><b>)</b><span class='class'>String.HTML.OBox</span>()<br><b>(</b><span class='datatype'>multiset</span><b>)</b><span class='class'>String.HTML.OBox</span>()</code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>It is possible to case this object to a string, which does the same as calling <code>render</code>, and to an array, which returns the cells in an array of rows.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><span class='object'>String.HTML.OBox</span> <span class='class'>String.HTML.OBox</span><b>(</b><code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>frame_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>cell_color</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>width</code>, <code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>padding</code>, <code class='datatype'>void</code>|<code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><b>)</b></code></p></dd> </dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>new_row</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>new_row</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Begin a new row. Succeeding cells will be added to this row instead of the current.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
45eff82002-06-11Johan Sundström <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>pad_rows</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>pad_rows</span>(</b><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
50af352002-07-15Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Ensures that all rows have the same number of cells.</p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>render</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>render</span>(</b><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
50af352002-07-15Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the result.</p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>set_cell_callback</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_cell_callback</span>(</b><code class='datatype'>function</code>(<code class='datatype'>int</code>, <code class='datatype'>int</code>, <code class='datatype'>string</code>, <code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>cell_callback</code><b>)</b></code></p></dd> </dl>
45eff82002-06-11Johan Sundström  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>set_extra_args</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_extra_args</span>(</b><code class='datatype'>array</code>(<code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>)) <code class='argument'>extra_args</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
50af352002-07-15Martin Nilsson <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>The argument in the mappings will be added to the cell in the cooresponding column of the table.</p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>set_extra_args</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_extra_args</span>(</b><code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>) <code class='argument'>extra_args</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>The argument in the mapping will be added to all created table cells.</p>
45eff82002-06-11Johan Sundström </dd></dl>
50af352002-07-15Martin Nilsson </dd></dl></dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Array</b></h2> </dt><dd>
45eff82002-06-11Johan Sundström  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>arrayify</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>arrayify</span>(</b><code class='datatype'>void</code>|<code class='datatype'>array</code>|<code class='datatype'>mixed</code> <code class='argument'>x</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Make an array of the argument, if it isn't already. A zero_type argument gives the empty array. This is useful when something is either an array or a basic datatype, for instance in headers from the MIME module or Protocols.HTTP.Server.</p>
45eff82002-06-11Johan Sundström </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'><span id='p-x'></span>Parameter <code class='parameter'>x</code></dt> <dd></dd><dd class='body--doc'><p>Result depends of the argument type:</p> <dl class='group--doc'><dt>arrayp(x)</dt> <dd><p>arrayify(x) =&gt; x</p> </dd> <dt>zero_type(x)</dt> <dd><p>arrayify(x) =&gt; ({})</p> </dd> <dt>otherwise</dt> <dd><p>arrayify(x) =&gt; ({ x })</p> </dd> </dl>
45eff82002-06-11Johan Sundström </dd></dl>
84d5df2002-09-16Johan Schön <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>common_prefix</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>common_prefix</span>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>) <code class='argument'>arrs</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Find the longest common prefix from an array of arrays.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>String.common_prefix</code></p> </dd></dl>
45eff82002-06-11Johan Sundström <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>count</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>count</span>(</b><code class='datatype'>array</code>|<code class='datatype'>mapping</code>|<code class='datatype'>multiset</code> <code class='argument'>haystack</code>, <code class='datatype'>mixed</code> <code class='argument'>needle</code><b>)</b></code><br> <code><code class='datatype'>mapping</code>(<code class='datatype'>mixed</code>:<code class='datatype'>int</code>) <b><span class='method'>count</span>(</b><code class='datatype'>array</code>|<code class='datatype'>mapping</code>|<code class='datatype'>multiset</code> <code class='argument'>haystack</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the number of occurrences of <code>needle</code> in <code>haystack</code>. If the optional <code>needle</code> argument is omitted, <code>count</code> instead works similar to the unix command <tt>sort|uniq -c</tt>, returning a mapping with the number of occurrences of each element in <code>haystack</code>. For array or mapping <code>haystack</code>s, it's the values that are counted, for multisets the indices, as you'd expect.</p>
45eff82002-06-11Johan Sundström </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>String.count</code>, <code>search</code>, <code>has_value</code></p>
45eff82002-06-11Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>dwim_sort_func</b></span>
45eff82002-06-11Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>dwim_sort_func</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
45eff82002-06-11Johan Sundström 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Sort without respect to number formatting (most notably leading zeroes).</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>flatten</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>flatten</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Flatten a multi-dimensional array to a one-dimensional array.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>greedy_diff</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>(<code class='datatype'>array</code>)) <b><span class='method'>greedy_diff</span>(</b><code class='datatype'>array</code> <code class='argument'>from</code>, <code class='datatype'>array</code> <code class='argument'>to</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Like <code>Array.diff</code>, but tries to generate bigger continuous chunks of the differences, instead of maximizing the number of difference chunks. More specifically, <code>greedy_diff</code> optimizes the cases where <code>Array.diff</code> returns <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;Z,&nbsp;B,&nbsp;({}),&nbsp;C,&nbsp;...&nbsp;})</code> <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;X,&nbsp;B,&nbsp;&nbsp;Y+B,&nbsp;C,&nbsp;...&nbsp;})</code> into the somewhat shorter diff arrays <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;Z,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B+C,&nbsp;...&nbsp;})</code> <code class='expr'>({&nbsp;...,&nbsp;A,&nbsp;X+B+Y,&nbsp;B+C,&nbsp;...&nbsp;})</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>lyskom_sort_func</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>lyskom_sort_func</span>(</b><code class='datatype'>string</code> <code class='argument'>a</code>, <code class='datatype'>string</code> <code class='argument'>b</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Sort comparison function that does not care about case, nor about the contents of any parts of the string enclosed with '()'</p> <p> Example: "Foo (bar)" is given the same weight as "foo (really!)"</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>oid_sort_func</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>oid_sort_func</span>(</b><code class='datatype'>string</code> <code class='argument'>a0</code>, <code class='datatype'>string</code> <code class='argument'>b0</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Sort with care of numerical sort for OID values: "1.2.1" before "1.11.1"</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>reduce</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>reduce</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>fun</code>, <code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> <code class='argument'>zero</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>reduce()</code> sends the first two elements in <code>arr</code> to <code>fun</code>, then the result and the next element in <code>arr</code> to <code>fun</code> and so on. Then it returns the result. The function will return <code>zero</code> if <code>arr</code> is the empty array. If <code>arr</code> has only one element, that element will be returned.</p>
1f918f2002-05-26Martin Nilsson </dd> <dt class='head--doc'>See also</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>rreduce()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>rreduce</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>rreduce</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>fun</code>, <code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> <code class='argument'>zero</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>rreduce()</code> sends the last two elements in <code>arr</code> to <code>fun</code>, then the third last element in <code>arr</code> and the result to <code>fun</code> and so on. Then it returns the result. The function will return <code>zero</code> if <code>arr</code> is the empty array. If <code>arr</code> has only one element, that element will be returned.</p>
e4e3f32002-04-06Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>reduce()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>search_array</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>search_array</span>(</b><code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>string</code>|<code class='datatype'>function</code>(:<code class='datatype void'>void</code>)|<code class='datatype'>int</code> <code class='argument'>fun</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>search_array()</code> works like <code>map()</code>, only it returns the index of the first call that returnes true instead.</p> <p> If no call returns true, -1 is returned.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>sum()</code>, <code>map()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>shuffle</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>shuffle</span>(</b><code class='datatype'>array</code> <code class='argument'>arr</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
f478692002-08-03Martin Nilsson <dd class='body--doc'><p><code>shuffle()</code> gives back the same elements, but in random order. The array is modified destructively.</p>
50af352002-07-15Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>permute()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>sort_array</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
a915f92002-09-18Martin Stjernholm <dd><p><code><code class='datatype'>array</code> <b><span class='method'>sort_array</span>(</b><code class='datatype'>array</code> <code class='argument'>arr</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>)|<code class='datatype'>void</code> <code class='argument'>cmp</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
a915f92002-09-18Martin Stjernholm <dd class='body--doc'><p>This function sorts the array <code>arr</code> after a compare-function <code>cmp</code> which takes two arguments and should return <tt>1</tt> if the first argument is larger then the second. Returns the sorted array - <code>arr</code> is not sorted destructively.</p>
50af352002-07-15Martin Nilsson <p> The remaining arguments <code>args</code> will be sent as 3rd, 4th etc. argument to <code>cmp</code>.</p> <p> If <code>cmp</code> is omitted, <code>`&gt;()</code> is used instead.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>map()</code>, <code>sort()</code>, <code>`&gt;()</code>, <code>dwim_sort_func</code>, <code>lyskom_sort_func</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>sum</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>sum</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Sum the elements of an array using `+</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>sum_arrays</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>sum_arrays</span>(</b><code class='datatype'>function</code>(<code class='datatype'>mixed</code> ... :<code class='datatype'>mixed</code>) <code class='argument'>sum</code>, <code class='datatype'>array</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Applies the function <code>sum</code> columnwise on the elements in the provided arrays. E.g. <tt>sum_array(`+,a,b,c)</tt> does the same as <tt>`+(a[*],b[*],c[*])</tt>.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>uniq2</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>uniq2</span>(</b><code class='datatype'>array</code> <code class='argument'>a</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Perform the same action as the Unix uniq command on an array, that is, fold consecutive occurrences of the same element into a single element of the result array:</p> <p> aabbbcaababb -&gt; abcabab.</p> <p> See also the <code>uniq</code> function.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Function</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>splice_call</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>splice_call</span>(</b><code class='datatype'>array</code> <code class='argument'>args</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code>|<code class='datatype'>void</code> ... <code class='argument'>extra</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Calls the given function with the <tt>args</tt> array plus the optional extra arguments as its arguments and returns the result.</p> <p> Most useful in conjunction with <code>map</code>, and particularly in combination with <code>sscanf</code> with <tt>"...%{...%}..."</tt> scan strings (which indeed was what it was invented for in the first place).</p> </dd> <dt class='head--doc'><span id='p-args'></span>Parameter <code class='parameter'>args</code></dt> <dd></dd><dd class='body--doc'><p>The first arguments the function <tt>f</tt> expects</p> </dd> <dt class='head--doc'><span id='p-f'></span>Parameter <code class='parameter'>f</code></dt> <dd></dd><dd class='body--doc'><p>The function to apply the arguments on</p> </dd> <dt class='head--doc'><span id='p-extra'></span>Parameter <code class='parameter'>extra</code></dt> <dd></dd><dd class='body--doc'><p>Optional extra arguments to send to <tt>f</tt></p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Whatever the supplied function <tt>f</tt> returns</p> </dd> <dt class='head--doc'>Example</dt> <dd class='example'><pre><p><code class='expr'> &nbsp;&nbsp;&nbsp;class&nbsp;Product(string&nbsp;name,&nbsp;string&nbsp;version) &nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string&nbsp;_sprintf() &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;sprintf("Product(%s/%s)",&nbsp;name,&nbsp;version); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;map(({&nbsp;({&nbsp;"pike",&nbsp;&nbsp;&nbsp;"7.1.11"&nbsp;}), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;({&nbsp;"whitefish",&nbsp;"0.1"&nbsp;})&nbsp;}), &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Function.splice_call,&nbsp;Product); &nbsp;&nbsp;&nbsp;({&nbsp;/*&nbsp;2&nbsp;elements&nbsp;*/ &nbsp;Product(pike/7.1.11), &nbsp;Product(whitefish/0.1) &nbsp;&nbsp;&nbsp;}) &nbsp;&nbsp;&nbsp;</code></p> </pre></dd></dl> </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>Program</b></h2> </dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>all_inherits</b></span> </dt> <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>program</code>) <b><span class='method'>all_inherits</span>(</b><code class='datatype'>program</code> <code class='argument'>p</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>inherit_tree</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>inherit_tree</span>(</b><code class='datatype'>program</code> <code class='argument'>p</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Recursively builds a inheritance tree by fetching programs inheritance lists.</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Returns an array with programs or arrays as elements.</p>
1f918f2002-05-26Martin Nilsson </dd> <dt class='head--doc'>Example</dt>
50af352002-07-15Martin Nilsson <dd class='example'><pre><p>&gt; class a{} &gt; class b{} &gt; class c{ inherit a; } &gt; class d{ inherit b; inherit c; } &gt; Program.inherit_tree(d); Result: ({ /* 3 elements */ d, ({ /* 1 element */ program }), ({ /* 2 elements */ c, ({ /* 1 element */ program }) }) })</p>
1f918f2002-05-26Martin Nilsson </pre></dd></dl>
50af352002-07-15Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>ADT</b></h2> </dt><dd><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Heap</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>adjust</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>adjust</span>(</b><code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>push</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>push</span>(</b><code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>size</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>size</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>top</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>top</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.History</b></h2>
1f918f2002-05-26Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>A history is a stack where you can only push entries. When the stack has reached a certain size the oldest entries are removed on every push. Other proposed names for this data type is leaking stack and table (where you push objects onto the table in one end and objects are falling off the table in the other.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_indices</b></span> </dt> <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>int</code>) <b><span class='method'>indices</span>(</b> <span class='class'>ADT.History</span> <span class='argument'>arg</span> <b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the index numbers of the history entries available.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>_sizeof</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>sizeof</span>(</b> <span class='class'>ADT.History</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>A <code>sizeof</code> operation on this object returns the number of elements currently in the history, e.g. &lt;= the current max size.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_values</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>values</span>(</b> <span class='class'>ADT.History</span> <span class='argument'>arg</span> <b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Returns the values of the available history entries.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`[]</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> res = <code class='class'>ADT.History()</code>[&#32;<code class='class'>i</code>&#32;]</code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Get a value from the history as if it was an array, e.g. both positive and negative numbers may be used. The positive numbers are however offset with 1, so [1] is the first entry in the history and [-1] is the last.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`[]=</b></span> </dt> <dd><p><code><code class='class'>ADT.History()</code>[&#32;<code class='class'>i</code>&#32;]&#32;=&#32;<code class='class'>value</code></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Overwrite one value in the history. The history position may be identified either by positive or negative offset, like <code>`[]</code>.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><span class='object'>ADT.History</span> <span class='class'>ADT.History</span><b>(</b><code class='datatype'>int</code> <code class='argument'>max_size</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>max_size</code> is the maximum number of entries that can reside in the history at the same time.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>flush</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>flush</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Empties the history. All entries in the history are removed, to allow garbage collect to remove them. The entry sequence counter is not reset.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>get_first_entry_num</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_first_entry_num</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the absolute sequence number of the
71b9cc2002-10-19Martin Nilsson  oldest result still in the history. Returns 0 if there are no results in the history.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>get_latest_entry_num</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_latest_entry_num</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the absolute sequence number of the latest result inserted into the history.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_maxsize</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_maxsize</span>(</b><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the maximum number of values in the history</p>
c628122002-10-19Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_maxsize</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>push</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>push</span>(</b><code class='datatype'>mixed</code> <code class='argument'>value</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Push a new value into the history.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
c628122002-10-19Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>query_no_adjacent_duplicates</b></span> </dt> <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>query_no_adjacent_duplicates</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Tells if the History object allows adjacent equal values. 1 means that only uniqe values are allowed adter each other.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>set_no_adjacent_duplicates</code></p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>set_maxsize</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_maxsize</span>(</b><code class='datatype'>int</code> <code class='argument'>_maxsize</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Set the maximume number of entries that can be stored in the history simultaneous.</p>
c628122002-10-19Martin Nilsson </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>get_maxsize</code></p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_no_adjacent_duplicates</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_no_adjacent_duplicates</span>(</b><code class='datatype'>bool</code> <code class='argument'>i</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Change how the History object should treat two identical values in a row. If 1 than only unique values are allowed after each other.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>query_no_adjacent_duplicates</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Priority_queue</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>adjust_pri</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>adjust_pri</span>(</b><code class='datatype'>mixed</code> <code class='argument'>handle</code>, <code class='datatype'>int</code> <code class='argument'>new_pri</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Inherit</span> <span class='homogen--name'><b>Heap</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><span class='datatype'>inherit .Heap</span> : <span class='inherit'>Heap</span></code></p></dd> </dl>
9699552002-03-12Martin Nilsson 
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pop</b></span> </dt> <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>pop</span>(</b><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>push</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>push</span>(</b><code class='datatype'>int</code> <code class='argument'>pri</code>, <code class='datatype'>mixed</code> <code class='argument'>val</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>Document this function</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Queue</b></h2> </dt><dd><dl class='group--doc'>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>A simple FIFO queue.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
932a632002-10-25Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>cast</b></span> </dt> <dd><p><code><b>(</b><span class='datatype'>int</span><b>)</b><span class='class'>ADT.Queue</span>()<br><b>(</b><span class='datatype'>float</span><b>)</b><span class='class'>ADT.Queue</span>()<br><b>(</b><span class='datatype'>string</span><b>)</b><span class='class'>ADT.Queue</span>()<br><b>(</b><span class='datatype'>array</span><b>)</b><span class='class'>ADT.Queue</span>()<br><b>(</b><span class='datatype'>mapping</span><b>)</b><span class='class'>ADT.Queue</span>()<br><b>(</b><span class='datatype'>multiset</span><b>)</b><span class='class'>ADT.Queue</span>()</code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>It is possible to cast ADT.Queue to an array.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>create</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><span class='object'>ADT.Queue</span> <span class='class'>ADT.Queue</span><b>(</b><code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
932a632002-10-25Martin Nilsson  <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Creates a queue with the initial items <code>args</code> in it.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>flush</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>flush</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Empties the queue.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>read</b></span><br> <span class='homogen--type'>Method</span> <span class='homogen--name'><b>get</b></span><br>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>read</span>(</b><b>)</b></code><br> <code><code class='datatype'>mixed</code> <b><span class='method'>get</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the next element from the queue.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>is_empty</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>bool</code> <b><span class='method'>is_empty</span>(</b><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns true if the queue is empty, otherwise zero.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>peek</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>peek</span>(</b><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the next element from the queue without removing it from the queue.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>write</b></span><br> <span class='homogen--type'>Method</span> <span class='homogen--name'><b>put</b></span><br>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>write</span>(</b><code class='datatype'>mixed</code> <code class='argument'>item</code><b>)</b></code><br> <code><code class='datatype'>void</code> <b><span class='method'>put</span>(</b><code class='datatype'>mixed</code> <code class='argument'>item</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Adds the <code>item</code> to the queue.</p> </dd></dl> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Stack</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This class implements a simple stack. Instead of adding and removing elements to an array, and thus making it vary in size for every push and pop operation, this stack tries to keep the stack size constant. If however the stack risks to overflow, it will allocate double its current size, i.e. pushing an element on an full 32 slot stack will result in a 64 slot stack with 33 elements.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_sizeof</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>sizeof</span>(</b> <span class='class'>ADT.Stack</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>sizeof</code> on a stack returns the number of entries in the stack.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>_values</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>values</span>(</b> <span class='class'>ADT.Stack</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>values</code> on a stack returns all the entries in the stack, in order.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`+</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='object unresolved'>this_program</code> res = <code class='class'>ADT.Stack()</code>&#32;+&#32;<code class='class'>s</code></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>A stack added with another stack yields a third a third stack will all the stack elements from the two first stacks.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><span class='object'>ADT.Stack</span> <span class='class'>ADT.Stack</span><b>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>initial_size</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>An initial stack size can be given when a stack is cloned. The default value is 32.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pop</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>pop</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>val</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Pops and returns entry <code>val</code> from the stack, counting from the top. If no value is given the top element is popped and returned. All popped entries are freed from the stack.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>push</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>push</span>(</b><code class='datatype'>mixed</code> <code class='argument'>val</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Push an element on the top of the stack.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>quick_pop</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>quick_pop</span>(</b><code class='datatype'>void</code>|<code class='datatype'>int</code> <code class='argument'>val</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Pops <code>val</code> entries from the stack, or one entry if no value is given. The popped entries are not actually freed, only the stack pointer is moved.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>reset</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>reset</span>(</b><code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>initial_size</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Empties the stack, resets the stack pointer and shrinks the stack size to the given value or 32 if none is given.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>create</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>set_stack</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>void</code> <b><span class='method'>set_stack</span>(</b><code class='datatype'>array</code> <code class='argument'>stack</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Sets the stacks content to the provided array.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>top</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>top</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the top element from the stack, without popping it.</p> </dd> <dt class='head--doc'>Throws</dt> <dd class='body--doc'><p>Throws an error if called on an empty stack.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
e8d6742002-12-05H. William Welliver III </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.struct</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>generic data structure</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>add_data</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>add_data</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Add data to struct</p> </dd> <dt class='head--doc'><span id='p-s'></span>Parameter <code class='parameter'>s</code></dt> <dd></dd><dd class='body--doc'><p>data to add to end of struct</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>contents</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>contents</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Return data, without removing it</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>contents of struct</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>create</b></span> </dt> <dd><p><code><span class='object'>ADT.struct</span> <span class='class'>ADT.struct</span><b>(</b><code class='datatype'>void</code>|<code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>create a new struct</p> </dd> <dt class='head--doc'><span id='p-s'></span>Parameter <code class='parameter'>s</code></dt> <dd></dd><dd class='body--doc'><p>initial data in struct</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_fix_string</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_fix_string</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_fix_uint_array</b></span> </dt> <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <b><span class='method'>get_fix_uint_array</span>(</b><code class='datatype'>int</code> <code class='argument'>item_size</code>, <code class='datatype'>int</code> <code class='argument'>size</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_rest</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_rest</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>get remainder of data from struct, clearing the struct</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>Remaining contents of struct</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_uint</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>get_uint</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_var_string</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>get_var_string</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_var_uint_array</b></span> </dt> <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>mixed</code>) <b><span class='method'>get_var_uint_array</span>(</b><code class='datatype'>int</code> <code class='argument'>item_size</code>, <code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>is_empty</b></span> </dt> <dd><p><code><code class='datatype'>int</code> <b><span class='method'>is_empty</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>is struct empty?</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>1 if empty, 0 otherwise</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>pop_data</b></span> </dt> <dd><p><code><code class='datatype'>string</code> <b><span class='method'>pop_data</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Return all data in struct, emptying the struct</p> </dd> <dt class='head--doc'>Returns</dt> <dd class='body--doc'><p>contents of struct</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put_bignum</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>put_bignum</span>(</b><code class='datatype'>object</code> <code class='argument'>i</code>, <code class='datatype'>int</code>|<code class='datatype'>void</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put_fix_string</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>put_fix_string</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put_fix_uint_array</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>put_fix_uint_array</span>(</b><code class='datatype'>array</code>(<code class='datatype'>int</code>) <code class='argument'>data</code>, <code class='datatype'>int</code> <code class='argument'>item_size</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put_uint</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>put_uint</span>(</b><code class='datatype'>int</code> <code class='argument'>i</code>, <code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Append an unsigned integer to struct</p> </dd> <dt class='head--doc'><span id='p-i'></span>Parameter <code class='parameter'>i</code></dt> <dd></dd><dd class='body--doc'><p>unsigned integer to append</p> </dd> <dt class='head--doc'><span id='p-len'></span>Parameter <code class='parameter'>len</code></dt> <dd></dd><dd class='body--doc'><p>length of integer in bytes</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put_var_string</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>put_var_string</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code>, <code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>put_var_uint_array</b></span> </dt> <dd><p><code><code class='datatype'>void</code> <b><span class='method'>put_var_uint_array</span>(</b><code class='datatype'>array</code>(<code class='datatype'>int</code>) <code class='argument'>data</code>, <code class='datatype'>int</code> <code class='argument'>item_size</code>, <code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd> <dt class='head--fixme'>FIXME</dt> <dd class='body--fixme'><p>document me!</p> </dd></dl>
50af352002-07-15Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>ADT.Relation</b></h2> </dt><dd><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Relation.Binary</b></h2> </dt><dd>
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_sizeof</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>sizeof</span>(</b> <span class='class'>ADT.Relation.Binary</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Returns the number of relation entries in the relation. (Or with other words: the number of relations in the relation set.)</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`&amp;</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> res = <code class='class'>ADT.Relation.Binary()</code>&#32;&amp;&#32;<code class='class'>rel</code></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>The expression `rel1 &amp; rel2' returns a new relation which has those and only those relation entries that are present in both rel1 and rel2.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
50af352002-07-15Martin Nilsson 
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`()</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> res = <code class='class'>ADT.Relation.Binary()</code>()</code></p></dd>
e4e3f32002-04-06Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Does the same as the <code>contains</code> function: returns true if the relation "<code>left</code> R <code>right</code>" exists, and otherwise false.</p>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>`-</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> res = <code class='class'>ADT.Relation.Binary()</code>&#32;-&#32;<code class='class'>rel</code></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>The expression `rel1 - rel2' returns a new relation which has those and only those relation entries that are present in rel1 and not present in rel2.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>`|</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> res = <code class='class'>ADT.Relation.Binary()</code>&#32;|&#32;<code class='class'>rel</code></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>The expression `rel1 | rel2' returns a new relation which has all the relation entries present in rel1, or rel2, or both.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>add</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>add</span>(</b><code class='datatype'>mixed</code> <code class='argument'>left</code>, <code class='datatype'>mixed</code> <code class='argument'>right</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Adds "<code>left</code> R <code>right</code>" as a member of the relation. Returns the same relation.</p>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>contains</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>contains</span>(</b><code class='datatype'>mixed</code> <code class='argument'>left</code>, <code class='datatype'>mixed</code> <code class='argument'>right</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Return true/false: does the relation "<code>left</code> R <code>right</code>" exist?</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>filter</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>filter</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Filters the entries in the relation, and returns a relation with all those entries for which the filtering function <code>f</code> returned true. The function <code>f</code> gets two arguments: the left and the right value for every entry in the relation.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>filter_destructively</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>filter_destructively</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Filters the entries in the relation destructively, removing all entries for which the filtering function <code>f</code> returns false. The function <code>f</code> gets two arguments: the left and the right value for each entry in the relation.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
69373f2002-09-12Leif Stensson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>find_shortest_path</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>find_shortest_path</span>(</b><code class='datatype'>mixed</code> <code class='argument'>from</code>, <code class='datatype'>mixed</code> <code class='argument'>to</code>, <code class='datatype'>void</code>|<code class='datatype'>multiset</code> <code class='argument'>avoiding</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Assuming the relation's domain and range sets are equal, and that the relation xRy means "there is a path from node x to node y", <code>find_shortest_path</code> attempts to find a path with a minimum number of steps from one given node to another. The path is returned as an array of nodes (including the starting and ending node), or 0 if no path was found. If several equally short paths exist, one of them will be chosen pseudorandomly.</p> <p> Trying to find a path from a node to itself will always succeed, returning an array of one element: the node itself. (Or in other words, a path with no steps, only a starting/ending point).</p> <p> The argument <code>avoiding</code> is either 0 (or omitted), or a multiset of nodes that must not be part of the path.</p> </dd></dl>
e4e3f32002-04-06Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>get_id</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>get_id</span>(</b><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Return the ID value which was given as first argument to create().</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
69373f2002-09-12Leif Stensson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>make_symmetric</b></span> </dt> <dd><p><code><code class='datatype'>object</code> <b><span class='method'>make_symmetric</span>(</b><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>Makes the relation symmetric, i.e. makes sure that if xRy is part of the relation set, then yRx should also be a part of the relation set.</p> </dd></dl>
1f918f2002-05-26Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>map</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>map</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Maps every entry in the relation. The function f gets two arguments: the left and the right relation value. Returns an array with the return values of f for each and every mapped entry.</p> <p> Note: since the entries in the relation are not ordered, the returned array will have its elements in no particular order. If you need to know which relation entry produced which result in the array, you have to make that information part of the value that <code>f</code> returns.</p>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>remove</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mixed</code> <b><span class='method'>remove</span>(</b><code class='datatype'>mixed</code> <code class='argument'>left</code>, <code class='datatype'>mixed</code> <code class='argument'>right</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Removes "<code>left</code> R <code>right</code>" as a member of the relation. Returns the same relation.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson <dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Relation.Binary._get_iterator</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>An iterator which makes all the left/right entities in the relation available as index/value pairs.</p> </dd></dl></dd></dl></dd></dl></dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>ADT.Table</b></h2> </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>ADT.Table is a generic module for manipulating tables.</p> <p> Each table contains one or several columns. Each column is associated with a name, the column name. Optionally, one can provide a column type. The Table module can do a number of operations on a given table, like computing the sum of a column, grouping, sorting etc.</p> <p> All column references are case insensitive. A column can be referred to by its position (starting from zero). All operations are non-destructive. That means that a new table object will be returned after, for example, a sort.</p> </dd></dl><dl><dt><h2 class='header'>Class <b class='ms datatype'>ADT.Table.table</b></h2>
e4e3f32002-04-06Martin Nilsson </dt><dd><dl class='group--doc'> <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>The table base-class.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_indices</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>string</code>) <b><span class='method'>indices</span>(</b> <span class='class'>ADT.Table.table</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns the column names for the table. The case used when the table was created will be returned.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>_sizeof</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> <b><span class='method'>sizeof</span>(</b> <span class='class'>ADT.Table.table</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns the number of rows in the table.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>_values</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code>(<code class='datatype'>array</code>) <b><span class='method'>values</span>(</b> <span class='class'>ADT.Table.table</span> <span class='argument'>arg</span> <b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns the contents of a table as a two dimensional array. The format is an array of rows. Each row is an array of columns.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>`==</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>int</code> res = <code class='class'>ADT.Table.table()</code>&#32;==&#32;<code class='class'>table</code></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method compares two tables. They are equal if the contents of the tables and the column names are equal. The column name comparison is case insensitive.</p>
9699552002-03-12Martin Nilsson </dd></dl>
1f918f2002-05-26Martin Nilsson 
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>`[]</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> res = <code class='class'>ADT.Table.table()</code>[&#32;<code class='class'>column</code>&#32;]</code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Same as <code>col()</code>.</p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>append_bottom</b></span> </dt> <dd><p><code><code class='datatype'>object</code> <b><span class='method'>append_bottom</span>(</b><code class='datatype'>object</code> <code class='argument'>table</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This method appends two tables. The table given as an argument will be added at the bottom of the current table. Note, the column names must be equal. The column name comparison is case insensitive.</p> </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>append_right</b></span> </dt> <dd><p><code><code class='datatype'>object</code> <b><span class='method'>append_right</span>(</b><code class='datatype'>object</code> <code class='argument'>table</code><b>)</b></code></p></dd>
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method appends two tables. The table given as an argument will be added on the right side of the current table. Note that the number of rows in both tables must be equal.</p>
9699552002-03-12Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson 
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>col</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>array</code> <b><span class='method'>col</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>column</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns the contents of a given column as an array.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
1f918f2002-05-26Martin Nilsson <span class='homogen--name'><b>create</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><span class='object'>ADT.Table.table</span> <span class='class'>ADT.Table.table</span><b>(</b><code class='datatype'>array</code>(<code class='datatype'>array</code>) <code class='argument'>table</code>, <code class='datatype'>array</code>(<code class='datatype'>string</code>) <code class='argument'>column_names</code>, <code class='datatype'>array</code>(<code class='datatype'>mapping</code>(<code class='datatype'>string</code>:<code class='datatype'>string</code>))|<code class='datatype'>void</code> <code class='argument'>column_types</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>The <code>ADT.Table.table</code> class takes two or three arguments:</p> </dd> <dt class='head--doc'><span id='p-table'></span>Parameter <code class='parameter'>table</code></dt> <dd></dd><dd class='body--doc'><p>The first argument is a two-dimensional array consisting of one array of columns per row. All rows must have the same number of columns as specified in <code>column_names</code>.</p>
1f918f2002-05-26Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'><span id='p-column_names'></span>Parameter <code class='parameter'>column_names</code></dt> <dd></dd><dd class='body--doc'><p>This argument is an array of column names associated with each column in the table. References by column name are case insensitive. The case used in <code>column_names</code> will be used when the table is displayed. A column can also be referred to by its position, starting from zero.</p>
1f918f2002-05-26Martin Nilsson </dd>
50af352002-07-15Martin Nilsson <dt class='head--doc'><span id='p-column_types'></span>Parameter <code class='parameter'>column_types</code></dt> <dd></dd><dd class='body--doc'><p>This is an optional array of mappings. The column type information is only used when displaying the table. Currently, only the keyword <tt>"type"</tt> is recognized. The type can be specified as <tt>"text"</tt> or <tt>"num"</tt> (numerical). Text columns are left adjusted, whereas numerical columns are right adjusted. If a mapping in the array is 0 (zero), it will be assumed to be a text column. If <code>column_types</code> is omitted, all columns will displayed as text.</p> <p> See <code>ADT.Table.ASCII.encode()</code> on how to display a table.</p> </dd> <dt class='head--doc'>See also</dt> <dd class='body--doc'><p><code>ADT.Table.ASCII.encode()</code></p>
e4e3f32002-04-06Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>decode</b></span>
e4e3f32002-04-06Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>decode</span>(</b><code class='datatype'>string</code> <code class='argument'>s</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson 
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns a table object from a binary string representation of a table, as returned by <code>encode()</code>.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson 
50af352002-07-15Martin Nilsson 
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>distinct</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>distinct</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> ... <code class='argument'>columns</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson 
e4e3f32002-04-06Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method groups by the given columns and returns a table with only unique rows. When no columns are given, all rows will be unique. A new table object will be returned.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
e4e3f32002-04-06Martin Nilsson 
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>encode</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>encode</span>(</b><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns a binary string representation of the table. It is useful when one wants to store a the table, for example in a file.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>group</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>group</span>(</b><code class='datatype'>mapping</code>(<code class='datatype'>int</code>|<code class='datatype'>string</code>:<code class='datatype'>function</code>(:<code class='datatype void'>void</code>))|<code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method calls the function <code>f</code> for each column each time a non uniqe row will be joined. The table will be grouped by the columns not listed. The result will be returned as a new table object.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>limit</b></span>
1f918f2002-05-26Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>limit</span>(</b><code class='datatype'>int</code> <code class='argument'>n</code><b>)</b></code></p></dd>
1f918f2002-05-26Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method truncates the table to the first <code>n</code> rows and returns a new object.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>map</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>map</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>array</code>(<code class='datatype'>int</code>|<code class='datatype'>string</code>)|<code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>columns</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method calls the function <code>f</code> for all rows in the table. The value returned will replace the values in the columns given as argument to map. If the function returns an array, several columns will be replaced. Otherwise the first column will be replaced. The result will be returned as a new table object.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
9699552002-03-12Martin Nilsson  <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>remove</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>remove</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> ... <code class='argument'>columns</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Like <code>select()</code>, but the given <code>columns</code> will not be in the resulting table.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>rename</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>rename</span>(</b><code class='datatype'>string</code>|<code class='datatype'>int</code> <code class='argument'>from</code>, <code class='datatype'>string</code> <code class='argument'>to</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method renames the column named <code>from</code> to <code>to</code> and returns a new table object. Note that <code>from</code> can be the column position.</p>
9699552002-03-12Martin Nilsson </dd></dl> <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>reverse</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>reverse</span>(</b><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method reverses the rows of the table and returns a new table object.</p>
1f918f2002-05-26Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>row</b></span> </dt> <dd><p><code><code class='datatype'>array</code> <b><span class='method'>row</span>(</b><code class='datatype'>int</code> <code class='argument'>row_number</code><b>)</b></code></p></dd>
9ade572002-06-12Johan Sundström <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns the contents of a given row as an array.</p>
9ade572002-06-12Johan Sundström </dd></dl>
50af352002-07-15Martin Nilsson 
9ade572002-06-12Johan Sundström <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>rsort</b></span>
9ade572002-06-12Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>rsort</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> ... <code class='argument'>columns</code><b>)</b></code></p></dd>
9ade572002-06-12Johan Sundström  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>Like <code>sort()</code>, but in descending order.</p>
9ade572002-06-12Johan Sundström </dd></dl> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>select</b></span>
9ade572002-06-12Johan Sundström </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>select</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> ... <code class='argument'>columns</code><b>)</b></code></p></dd>
9ade572002-06-12Johan Sundström  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns a new table object with the selected columns only.</p>
9ade572002-06-12Johan Sundström </dd></dl>
9699552002-03-12Martin Nilsson <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>sort</b></span>
9699552002-03-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>sort</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> ... <code class='argument'>columns</code><b>)</b></code></p></dd>
9699552002-03-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method sorts the table in ascendent order on one or several columns and returns a new table object. The left most column is sorted last. Note that the sort is stable.</p>
9699552002-03-12Martin Nilsson </dd>
1f918f2002-05-26Martin Nilsson <dt class='head--doc'>See also</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p><code>rsort()</code></p>
1f918f2002-05-26Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>sum</b></span> </dt> <dd><p><code><code class='datatype'>object</code> <b><span class='method'>sum</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> ... <code class='argument'>columns</code><b>)</b></code></p></dd>
013acc2002-06-28Martin Nilsson <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method sums all equal rows. The table will be grouped by the columns not listed. The result will be returned as a new table object.</p>
013acc2002-06-28Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson 
013acc2002-06-28Martin Nilsson <hr /> <dl class='group--doc'>
50af352002-07-15Martin Nilsson <dt class='head--type'><span class='homogen--type'>Method</span> <span class='homogen--name'><b>type</b></span>
013acc2002-06-28Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>mapping</code> <b><span class='method'>type</span>(</b><code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>column</code>, <code class='datatype'>void</code>|<code class='datatype'>mapping</code> <code class='argument'>type</code><b>)</b></code></p></dd> <dt class='head--doc'>Description</dt> <dd class='body--doc'><p>This method gives the type for the given <code>column</code>.</p> <p> If a second argument is given, the old type will be replaced with <code>type</code>. The column type is only used when the table is displayed. The format is as specified in <code>create()</code>.</p> </dd></dl>
013acc2002-06-28Martin Nilsson  <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>where</b></span>
013acc2002-06-28Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>object</code> <b><span class='method'>where</span>(</b><code class='datatype'>array</code>(<code class='datatype'>int</code>|<code class='datatype'>string</code>)|<code class='datatype'>int</code>|<code class='datatype'>string</code> <code class='argument'>columns</code>, <code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>f</code>, <code class='datatype'>mixed</code> ... <code class='argument'>args</code><b>)</b></code></p></dd>
013acc2002-06-28Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method calls the function for each row. If the function returns zero, the row will be thrown away. If the function returns something non-zero, the row will be kept. The result will be returned as a new table object.</p>
013acc2002-06-28Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson </dd></dl><dl><dt><h2 class='header'>Module <b class='ms datatype'>ADT.Table.ASCII</b></h2>
f2d60f2002-06-12Martin Nilsson </dt><dd> <hr /> <dl class='group--doc'> <dt class='head--type'><span class='homogen--type'>Method</span>
50af352002-07-15Martin Nilsson <span class='homogen--name'><b>encode</b></span>
f2d60f2002-06-12Martin Nilsson </dt>
50af352002-07-15Martin Nilsson <dd><p><code><code class='datatype'>string</code> <b><span class='method'>encode</span>(</b><code class='datatype'>object</code> <code class='argument'>table</code>, <code class='datatype'>void</code>|<code class='datatype'>mapping</code> <code class='argument'>options</code><b>)</b></code></p></dd>
f2d60f2002-06-12Martin Nilsson  <dt class='head--doc'>Description</dt>
50af352002-07-15Martin Nilsson <dd class='body--doc'><p>This method returns a table represented in ASCII suitable for human eyes. <code>options</code> is an optional mapping. If the keyword <tt>"indent"</tt> is used with a number, the table will be indented with that number of space characters.</p>
f2d60f2002-06-12Martin Nilsson </dd></dl>
50af352002-07-15Martin Nilsson </dd></dl></dd></dl></dd></dl></dd></dl></body></html>