idf.h 1014 B

12345678910111213141516171819202122232425262728293031
  1. /* This file is part of the software similarity tester SIM.
  2. Written by Dick Grune, Vrije Universiteit, Amsterdam.
  3. $Id: idf.h,v 2.5 1998/02/03 14:28:25 dick Exp $
  4. */
  5. /* Idf module:
  6. TOKEN idf_in_list(char *str, struct idf l[], sizeof l, TOKEN dflt);
  7. looks up a keyword in a list of keywords l, represented as an
  8. array of struct idf, and returns its translation as a token;
  9. dflt is returned if the keyword is not found.
  10. TOKEN idf_hashed(char *str);
  11. returns a token unequal to SKIP or EOL, derived from the str
  12. through hashing
  13. It is assumed that SKIP will be ignored by the user of this module.
  14. */
  15. #include "token.h"
  16. /* the struct for keywords etc. */
  17. struct idf {
  18. char *id_tag; /* an interesting identifier */
  19. TOKEN id_tr; /* with its one-token translation */
  20. };
  21. /* special tokens for the idf module */
  22. #define SKIP NORM('\0')
  23. #define IDF NORM('@')
  24. /* public functions */
  25. extern TOKEN idf_in_list(const char *, const struct idf [], unsigned int, TOKEN);
  26. extern TOKEN idf_hashed(const char *);