Research portable Memory game | Исследовать портируемую игру Память
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.3KB

  1. <!DOCTYPE html
  2. PUBLIC "-//W3C//DTD XTHML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5. <head>
  6. <link rel="stylesheet" type="text/css" href="styles.css" />
  7. <title>uthash: a hash table for C structures</title>
  8. </head>
  9. <body>
  10. <div id="banner">
  11. <img src="banner.png" alt="uthash: a hash table for C structures" />
  12. </div> <!-- banner -->
  13. <div id="topnav">
  14. <a href="http://github.com/troydhanson/uthash">GitHub page</a> &gt;
  15. uthash home <!-- http://troydhanson.github.com/uthash/ -->
  16. <a href="https://twitter.com/share" class="twitter-share-button" data-via="troydhanson">Tweet</a>
  17. <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
  18. </div>
  19. <hr />
  20. <div id="mid">
  21. <div id="nav">
  22. <h2>documentation</h2>
  23. <div><a href="userguide.html">uthash</a></div>
  24. <div><a href="utlist.html">utlist</a></div>
  25. <div><a href="utarray.html">utarray</a></div>
  26. <div><a href="utringbuffer.html">utringbuffer</a></div>
  27. <div><a href="utstack.html">utstack</a></div>
  28. <div><a href="utstring.html">utstring</a></div>
  29. <h2>download</h2>
  30. <h3>GNU/Linux, Windows</h3>
  31. <div><a href=https://github.com/troydhanson/uthash/archive/master.zip>uthash-master.zip</a></div>
  32. <div><a href=https://github.com/troydhanson/uthash>git clone</a></div>
  33. <h2>license</h2>
  34. <div><a href="license.html">BSD revised</a></div>
  35. <h2>developer</h2>
  36. <div><a href="http://troydhanson.github.io/">Troy D. Hanson</a></div>
  37. <h2>maintainer</h2>
  38. <div><a href="https://github.com/Quuxplusone">Arthur O'Dwyer</a></div>
  39. </div>
  40. <div id="main">
  41. Any C structure can be stored in a hash table using uthash. Just add a
  42. <em>UT_hash_handle</em> to the structure and choose one or more fields
  43. in your structure to act as the key. Then use these macros to store,
  44. retrieve or delete items from the hash table.
  45. <div class="listing">
  46. Example 1. Adding an item to a hash.
  47. <div class="code">
  48. <pre>
  49. #include "uthash.h"
  50. struct my_struct {
  51. int id; /* we'll use this field as the key */
  52. char name[10];
  53. UT_hash_handle hh; /* makes this structure hashable */
  54. };
  55. struct my_struct *users = NULL;
  56. void add_user(struct my_struct *s) {
  57. HASH_ADD_INT(users, id, s);
  58. }
  59. </pre>
  60. </div> <!-- code -->
  61. </div> <!-- listing -->
  62. <div class="listing">
  63. Example 2. Looking up an item in a hash.
  64. <div class="code">
  65. <pre>
  66. struct my_struct *find_user(int user_id) {
  67. struct my_struct *s;
  68. HASH_FIND_INT(users, &amp;user_id, s);
  69. return s;
  70. }
  71. </pre>
  72. </div> <!-- code -->
  73. </div> <!-- listing -->
  74. <div class="listing">
  75. Example 3. Deleting an item from a hash.
  76. <div class="code">
  77. <pre>
  78. void delete_user(struct my_struct *user) {
  79. HASH_DEL(users, user);
  80. }
  81. </pre>
  82. </div> <!-- code -->
  83. </div> <!-- listing -->
  84. For more information and examples, please see the <a href="userguide.html">User Guide.</a>
  85. </div> <!-- main -->
  86. </div> <!-- mid -->
  87. <hr />
  88. <div id="footer">
  89. </div> <!-- footer -->
  90. </body>
  91. </html>