Hash Tables Tutorial — File Browser

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

snippets.htm — 3.29 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 - snippets</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	font-family: Tahoma;
	font-size: 12px;
}
.style5 {
font-family: Tahoma;
font-size: 24px;
.style6 {font-size: 18px}
.style7 {color: #0000FF}
-->
</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"><u>SNIPPET</u></p>
        <p>;Instructions</p>
        <p>if the hash table is needed to be made and loaded first<br>
            You will see a dialog appearing asking you to locate directory containing hash table <br>
            you want to make and load</p>
        <p>if you want to make and load hash table first, then add &quot;-z&quot; to end<br>
          if you don't want to free hash table at end, then add a &quot;-x&quot; after the z <br>
          space in between the -z and -x , see usage below</p>
        <p>if you previouslly saved the hash table as a binary file, data only or ini format<br>
          you will need to apply the respective switches for this, hense what the &lt;switches&gt; is for<br>
          -b = binary file , -n = data read only , -i = hash table treated like a ini file</p>
        <p class="style7">USAGE: /get.hash &lt;hash table name&gt; &lt;switches&gt; -z -x</p>
        <p>Now its very important you have 3 items after the hash table name, even if you don't want to <br>
          use a certain part. so any part you don't want to use, replace with a &quot;no&quot;, see below</p>
        <p><br>
            <span class="style7">USAGE; /get.hash &lt;hash table name&gt; no no -x</span></p>
        <p><span class="style7">alias get.hash {<br>
  window -ak(0) @hash<br>
  aline @hash Item $chr(9) $chr(9) Data<br>
  aline @hash ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
  var %hash.name = $1 <br>
  var %switches = $2<br>
  if ( $3 == -z ) { <br>
  var %hashtable = $+(&quot;,$sfile($mircdir),&quot;)<br>
  hmake %hash.name<br>
  if ( %switches == no ) { hload %hash.name %hashtable }<br>
  else { hload %switches %hash.name %hashtable }<br>
  }<br>
  var %i = 1<br>
  while ( $hget(%hash.name,%i).item ) {<br>
  var %item = $ifmatch , %data = $hget(%hash.name,%i).data<br>
  aline @hash %item $chr(9) $chr(9) %data<br>
  inc %i<br>
  }<br>
  if ( $4 == -x ) { hfree %hash.name }<br>
  }</span><br>
        </p>
        <p align="left" class="style1">&nbsp;</p>
        <p align="left" class="style1">&nbsp; </p>
        <p align="center" class="style5">&nbsp;</p>
        <p align="left" class="style1">&nbsp;</p>
        <p align="left" class="style1">&nbsp;</p>
        <p align="left" class="style1">&nbsp; </p>
        <p align="left" class="style1">&nbsp;</p>
	    <p align="left" class="style1">&nbsp; </p>
	    <p align="left" class="style1">&nbsp; </p>
	    <p align="left" class="style1">&nbsp;</p>
	    <p align="left" class="style1">&nbsp; </p>
	    <p align="left" class="style1">&nbsp;</p>
	    <p align="left" class="style1">&nbsp;</p>
      </div></th>
    </tr>
  </table>
</div>
</body>
</html>