idf_pkg.spec 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* $Id$ */
  2. /* IDENTIFIER DESCRIPTOR */
  3. #include <ansi.h>
  4. /* This a generic package for maintaining a name list */
  5. /* Instantiation parameters, supplied by #define, are :
  6. IDF_TYPE: the type of the user-defined part of the idf-structure,
  7. IDF_NAME: the selector name for this field in the idf_structure, and
  8. IDF_HSIZE: the number of significant characters for hashing
  9. */
  10. #ifndef IDF_NAME
  11. #define IDF_NAME id_user
  12. #endif
  13. struct idf {
  14. struct idf *id_next; /* links idf-structures together */
  15. char *id_text; /* string representing the name */
  16. #ifdef IDF_TYPE
  17. IDF_TYPE IDF_NAME; /* user defined type and selector */
  18. #endif
  19. };
  20. /* init_idf()
  21. Initializes the namelist.
  22. */
  23. _PROTOTYPE(void init_idf, (void));
  24. /* struct idf * str2idf(tg, cp)
  25. char *tg;
  26. int cp;
  27. Adds the string indicated by "tg" to the namelist, and returns a
  28. pointer to the entry.
  29. If cp > 0, a copy of tg is made for id_text, otherwise tg itself
  30. is used.
  31. If cp < 0, the string is not entered, but only looked for.
  32. */
  33. _PROTOTYPE(struct idf *str2idf, (char *, int));
  34. #define findidf(tg) str2idf(tg, -1)