Windows NT 4.0 source code leak
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.

85 lines
2.6 KiB

5 years ago
  1. #ifndef __dict_list_h_
  2. #define __dict_list_h_
  3. /*
  4. ** Copyright 1994, Silicon Graphics, Inc.
  5. ** All Rights Reserved.
  6. **
  7. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  8. ** the contents of this file may not be disclosed to third parties, copied or
  9. ** duplicated in any form, in whole or in part, without the prior written
  10. ** permission of Silicon Graphics, Inc.
  11. **
  12. ** RESTRICTED RIGHTS LEGEND:
  13. ** Use, duplication or disclosure by the Government is subject to restrictions
  14. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  15. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  16. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  17. ** rights reserved under the Copyright Laws of the United States.
  18. **
  19. ** Author: Eric Veach, July 1994.
  20. */
  21. /* Use #define's so that another heap implementation can use this one */
  22. #define DictKey DictListKey
  23. #define Dict DictList
  24. #define DictNode DictListNode
  25. #define dictNewDict(frame,leq) __gl_dictListNewDict(frame,leq)
  26. #define dictDeleteDict(dict) __gl_dictListDeleteDict(dict)
  27. #define dictSearch(dict,key) __gl_dictListSearch(dict,key)
  28. #define dictInsert(dict,key) __gl_dictListInsert(dict,key)
  29. #define dictInsertBefore(dict,node,key) __gl_dictListInsertBefore(dict,node,key)
  30. #define dictDelete(dict,node) __gl_dictListDelete(dict,node)
  31. #define dictKey(n) __gl_dictListKey(n)
  32. #define dictSucc(n) __gl_dictListSucc(n)
  33. #define dictPred(n) __gl_dictListPred(n)
  34. #define dictMin(d) __gl_dictListMin(d)
  35. #define dictMax(d) __gl_dictListMax(d)
  36. typedef void *DictKey;
  37. typedef struct Dict Dict;
  38. typedef struct DictNode DictNode;
  39. Dict *dictNewDict(
  40. void *frame,
  41. int (*leq)(void *frame, DictKey key1, DictKey key2) );
  42. void dictDeleteDict( Dict *dict );
  43. /* Search returns the node with the smallest key greater than or equal
  44. * to the given key. If there is no such key, returns a node whose
  45. * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc.
  46. */
  47. DictNode *dictSearch( Dict *dict, DictKey key );
  48. DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key );
  49. void dictDelete( Dict *dict, DictNode *node );
  50. #define __gl_dictListKey(n) ((n)->key)
  51. #define __gl_dictListSucc(n) ((n)->next)
  52. #define __gl_dictListPred(n) ((n)->prev)
  53. #define __gl_dictListMin(d) ((d)->head.next)
  54. #define __gl_dictListMax(d) ((d)->head.prev)
  55. #define __gl_dictListInsert(d,k) (dictInsertBefore((d),&(d)->head,(k)))
  56. /*** Private data structures ***/
  57. struct DictNode {
  58. DictKey key;
  59. DictNode *next;
  60. DictNode *prev;
  61. };
  62. struct Dict {
  63. DictNode head;
  64. void *frame;
  65. int (*leq)(void *frame, DictKey key1, DictKey key2);
  66. };
  67. #endif