hash.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. (*
  2. * Summary: Chained hash tables
  3. * Description: This module implements the hash table support used in
  4. * various places in the library.
  5. *
  6. * Copy: See Copyright for the status of this software.
  7. *
  8. * Author: Bjorn Reese <[email protected]>
  9. *)
  10. {$IFDEF TYPE}
  11. (*
  12. * The hash table.
  13. *)
  14. xmlHashTable = record
  15. end;
  16. (*
  17. * Recent version of gcc produce a warning when a function pointer is assigned
  18. * to an object pointer, or vice versa. The following macro is a dirty hack
  19. * to allow suppression of the warning. If your architecture has function
  20. * pointers which are a different size than a void pointer, there may be some
  21. * serious trouble within the library.
  22. *)
  23. (*
  24. * function types:
  25. *)
  26. (**
  27. * xmlHashDeallocator:
  28. * @payload: the data in the hash
  29. * @name: the name associated
  30. *
  31. * Callback to free data from a hash.
  32. *)
  33. xmlHashDeallocator = procedure(payload: pointer; name: xmlCharPtr); cdecl;
  34. (**
  35. * xmlHashCopier:
  36. * @payload: the data in the hash
  37. * @name: the name associated
  38. *
  39. * Callback to copy data from a hash.
  40. *
  41. * Returns a copy of the data or NULL in case of error.
  42. *)
  43. xmlHashCopier = function(payload: pointer; name: xmlCharPtr): pointer; cdecl;
  44. (**
  45. * xmlHashScanner:
  46. * @payload: the data in the hash
  47. * @data: extra scannner data
  48. * @name: the name associated
  49. *
  50. * Callback when scanning data in a hash with the simple scanner.
  51. *)
  52. xmlHashScanner = procedure(payload: pointer; data: pointer; name: xmlCharPtr); cdecl;
  53. (**
  54. * xmlHashScannerFull:
  55. * @payload: the data in the hash
  56. * @data: extra scannner data
  57. * @name: the name associated
  58. * @name2: the second name associated
  59. * @name3: the third name associated
  60. *
  61. * Callback when scanning data in a hash with the full scanner.
  62. *)
  63. xmlHashScannerFull = procedure(payload: pointer; data: pointer; name, name2, name3: xmlCharPtr); cdecl;
  64. {$ENDIF}
  65. {$IFDEF FUNCTION}
  66. (*
  67. * Constructor and destructor.
  68. *)
  69. function xmlHashCreate(size: cint): xmlHashTablePtr; cdecl; external;
  70. function xmlHashCreateDict(size: cint; dict: xmlDictPtr): xmlHashTablePtr; cdecl; external;
  71. procedure xmlHashFree(table: xmlHashTablePtr; f: xmlHashDeallocator); cdecl; external;
  72. (*
  73. * Add a new entry to the hash table.
  74. *)
  75. function xmlHashAddEntry(table: xmlHashTablePtr; name: xmlCharPtr; userdata: pointer): cint; cdecl; external;
  76. function xmlHashUpdateEntry(table: xmlHashTablePtr; name: xmlCharPtr; userdata: pointer; f: xmlHashDeallocator): cint; cdecl; external;
  77. function xmlHashAddEntry2(table: xmlHashTablePtr; name, name2: xmlCharPtr; userdata: pointer): cint; cdecl; external;
  78. function xmlHashUpdateEntry2(table: xmlHashTablePtr; name, name2: xmlCharPtr; userdata: pointer; f: xmlHashDeallocator): cint; cdecl; external;
  79. function xmlHashAddEntry3(table: xmlHashTablePtr; name, name2, name3: xmlCharPtr; userdata: pointer): cint; cdecl; external;
  80. function xmlHashUpdateEntry2(table: xmlHashTablePtr; name, name2, name3: xmlCharPtr; userdata: pointer; f: xmlHashDeallocator): cint; cdecl; external;
  81. (*
  82. * Remove an entry from the hash table.
  83. *)
  84. function xmlHashRemoveEntry(table: xmlHashTablePtr; name: xmlCharPtr; f: xmlHashDeallocator): cint; cdecl; external;
  85. function xmlHashRemoveEntry2(table: xmlHashTablePtr; name, name2: xmlCharPtr; f: xmlHashDeallocator): cint; cdecl; external;
  86. function xmlHashRemoveEntry3(table: xmlHashTablePtr; name, name2, name3: xmlCharPtr; f: xmlHashDeallocator): cint; cdecl; external;
  87. (*
  88. * Retrieve the userdata.
  89. *)
  90. function xmlHashRemoveEntry(table: xmlHashTablePtr; name: xmlCharPtr): pointer; cdecl; external;
  91. function xmlHashRemoveEntry2(table: xmlHashTablePtr; name, name2: xmlCharPtr): pointer; cdecl; external;
  92. function xmlHashRemoveEntry3(table: xmlHashTablePtr; name, name2, name3: xmlCharPtr): pointer; cdecl; external;
  93. function xmlHashQLookup(table: xmlHashTablePtr; name, prefix: xmlCharPtr): pointer; cdecl; external;
  94. function xmlHashQLookup2(table: xmlHashTablePtr; name, prefix, name2, prefix2: xmlCharPtr): pointer; cdecl; external;
  95. function xmlHashQLookup3(table: xmlHashTablePtr; name, prefix, name2, prefix2, name3, prefix3: xmlCharPtr): pointer; cdecl; external;
  96. (*
  97. * Helpers.
  98. *)
  99. function xmlHashCopy(table: xmlHashTablePtr; f: xmlHashCopier): xmlHashTablePtr; cdecl; external;
  100. function xmlHashSize(table: xmlHashTablePtr): cint; cdecl; external;
  101. procedure xmlHashScan(table: xmlHashTablePtr; f: xmlHashScanner; data: pointer); cdecl; external;
  102. procedure xmlHashScan(table: xmlHashTablePtr; name, name2, name3: xmlCharPtr; f: xmlHashScanner; data: pointer); cdecl; external;
  103. procedure xmlHashScanFull(table: xmlHashTablePtr; f: xmlHashScannerFull; data: pointer); cdecl; external;
  104. procedure xmlHashScanFull(table: xmlHashTablePtr; name, name2, name3: xmlCharPtr; f: xmlHashScannerFull; data: pointer); cdecl; external;
  105. {$ENDIF}