stringmap.h 767 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * stringmap.h:
  3. * map of strings
  4. *
  5. * Copyright (c) 2001 Chris Lightfoot. All rights reserved.
  6. *
  7. * $Id: stringmap.h,v 1.1 2003/10/19 06:44:33 pdw Exp $
  8. *
  9. */
  10. #ifndef __STRINGMAP_H_ /* include guard */
  11. #define __STRINGMAP_H_
  12. #include "vector.h"
  13. typedef struct _stringmap {
  14. char *key;
  15. item d;
  16. struct _stringmap *l, *g;
  17. } *stringmap;
  18. stringmap stringmap_new(void);
  19. void stringmap_delete(stringmap);
  20. void stringmap_delete_free(stringmap);
  21. /* Try to insert an item into a stringmap, returning 1 if the map already
  22. * contained an item with that key.
  23. */
  24. item *stringmap_insert(stringmap, const char*, const item);
  25. /* Find an item in a stringmap */
  26. stringmap stringmap_find(const stringmap, const char*);
  27. #endif /* __STRINGMAP_H_ */