Hash Tables Tutorial — File Browser

HashTablesTutorialv1.0 / HashTablesTutorialv1.0 / HT-Tutorial / Hash Tables / commands.htm

commands.htm — 6.25 KB — Download this file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Hash Tables - Commands</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	font-family: Tahoma;
	font-size: 12px;
}
.style2 {color: #0000CC}
.style3 {
	color: #0000FF;
	font-weight: bold;
}
.style4 {color: #0000FF}
.style5 {
font-family: Tahoma;
font-size: 24px;
-->
</style>
</head>

<body bgcolor="#F2FDFF" text="#000000">


<div align="center">
  <table width="500" border="0">
    <tr>
      <th width="500" scope="col"><div align="left">
	    <p align="center" class="style5"></span><u>COMMANDS</u></p>
        <p class="style3">/<span class="style1">hmake -s &lt;name&gt; &lt;N&gt;</span></p>        
        <p class="style1"><br>
            Creates a new hash table with N slots.</p>
        <p class="style1">A hash table can store an unlimited number of items regardless of the N you choose, however the bigger N is, the faster it will work, depending on the number of items stored.</p>
        <p class="style1">eg. if you expect that you'll be storing 1000 items in the table, a table of N set to 100 is quite sufficient.</p>
        <p class="style1">The -s switch makes the command display the result.</p>
        <p class="style1 style2">/hfree -sw &lt;name&gt;</p>
        <p class="style1">Frees an existing hash table.</p>
        <p class="style1">The -w switch indicates that name is a wildcard, all matching tables are freed.</p>
        <p class="style1"><span class="style4">/hadd -smbczuN &lt;name&gt; &lt;item&gt; [data | &amp;binvar]</span></p>
        <p class="style1"><br>
            Adds an item to an existing hash table.</p>
        <p class="style1">If the item you're adding already exists, the old item is replaced.</p>
        <p class="style1">The -m switch makes /hadd create the hash table if it doesn't already exist.</p>
        <p class="style1">The -uN switch unsets the item after N seconds.</p>
        <p class="style1">The -b indicates that you're adding a &amp;binvar item to the hash table.</p>
        <p class="style1">The -c switch chops the &amp;binvar up to the first null value and treats it as plain text.</p>
        <p class="style1">The -z switch decreases hash item once per second until it reaches zero and then unsets it.</p>
        <p class="style1">The /hinc and /hdec commands use the same parameters as /hadd and increase or decrease the number value of an item.</p>
        <p class="style1">When used with /hinc or /hdec, the -c switch increases or decreases the value once per second.</p>
        <p class="style1"><span class="style4">/hdel -sw &lt;name&gt; &lt;item&gt;</span></p>
        <p class="style1"><br>
            Deletes an item from a hash table.</p>
        <p class="style1">The -w switch indicates that item is a wildcard, all matching items are freed.</p>
        <p class="style1"><span class="style4">/hload -sbni &lt;name&gt; &lt;filename&gt; [section]<br>
  /hsave -sbnioau &lt;name&gt; &lt;filename&gt; [section]</span></p>
        <p class="style1"><br>
            Load or save a table to/from a file.</p>
        <p class="style1">These load/save plain text to a text file, with item and data on separate lines. $cr and $lf characters are stripped from text when saving as plain text.</p>
        <p class="style1">The -b switch loads or saves binary files. $cr and $lf are preserved when saving as binary files.</p>
        <p class="style1">You can use -n to load or save files as data only, with no items. When loading with -n each line of data is assigned an N item value, starting at N = 1.</p>
        <p class="style1">/hsave also supports -o to overwite an existing file, and -a to append to an existing file.</p>
        <p class="style1">By default /hsave excludes items that are in the /hadd -uN unset list, the -u switch forces it to include the unset items.</p>
        <p class="style1">The -i switch treats the file as an ini file. You can specify an optional section name after the filename.</p>
        <p class="style1">Note: /hload does not create the table, it must already have been created by /hmake.</p>
        <p class="style1"><span class="style4">$hget(name/N)</span></p>
        <p class="style1"><br>
            Returns name of a hash table if it exists, or returns the name of the Nth hash table.</p>
        <p class="style1">Properties: size</p>
        <p class="style1">$hget(moo).size returns the N size of table, as specified in /hmake</p>
        <p class="style1"><span class="style4">$hget(name/N, item)</span></p>
        <p class="style1"><br>
            Returns the data associated with an item in the specified hash table.</p>
        <p class="style1">Properties: unset</p>
        <p class="style1">The unset property returns the time remaining before an item is unset.</p>
        <p class="style1"><span class="style4">$hget(name/N, item, &amp;binvar)</span><br>
  Assigns the contents of an item to a &amp;binvar.</p>
        <p class="style1"><span class="style4">$hget(name/N, N).item</span><br>
          This allows you to reference the table as an index from 0 to N, in order to look up the Nth item in the table.</p>
        <p class="style1">If N is zero, returns the total number of items in the table.</p>
        <p class="style1">You can also reference the Nth data value directly with $hget().data.</p>
        <p class="style1">Note: This method is provided as a convenience, it is not an efficient way to use the hash table.</p>
        <p class="style1"><span class="style4">$hfind(name/N, text, N, M)</span><br>
          Searches table for the Nth item name which matches text. Returns item name.</p>
        <p class="style1">Properties: data</p>
        <p class="style1">If you specify the .data property, searches for a matching data value.</p>
        <p class="style1">M is optional, and can be:</p>
        <p class="style1"> n normal text comparison (default if M isn't specified)<br>
  w text is wildcard text<br>
  W hash table item/data is wildcard text</p>
        <p class="style1"> r text is regular expression<br>
  R hash table item/data is regular expression</p>
      </div></th>
    </tr>
  </table>
</div>
</body>
</html>