names.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Names.h - names and types used by ascmagic in file(1).
  3. * These tokens are here because they can appear anywhere in
  4. * the first HOWMANY bytes, while tokens in /etc/magic must
  5. * appear at fixed offsets into the file. Don't make HOWMANY
  6. * too high unless you have a very fast CPU.
  7. *
  8. * Copyright (c) Ian F. Darwin, 1987.
  9. * Written by Ian F. Darwin.
  10. *
  11. * See LEGAL.NOTICE
  12. *
  13. * $Id: names.h,v 1.13 1997/01/15 17:23:24 christos Exp $
  14. */
  15. /* these types are used to index the table 'types': keep em in sync! */
  16. #define L_C 0 /* first and foremost on UNIX */
  17. #define L_CC 1 /* Bjarne's postincrement */
  18. #define L_FORT 2 /* the oldest one */
  19. #define L_MAKE 3 /* Makefiles */
  20. #define L_PLI 4 /* PL/1 */
  21. #define L_MACH 5 /* some kinda assembler */
  22. #define L_ENG 6 /* English */
  23. #define L_PAS 7 /* Pascal */
  24. #define L_MAIL 8 /* Electronic mail */
  25. #define L_NEWS 9 /* Usenet Netnews */
  26. static char *types[] = {
  27. "C program text",
  28. "C++ program text",
  29. "FORTRAN program text",
  30. "make commands text" ,
  31. "PL/1 program text",
  32. "assembler program text",
  33. "English text",
  34. "Pascal program text",
  35. "mail text",
  36. "news text",
  37. "can't happen error on names.h/types",
  38. 0};
  39. static struct names {
  40. char *name;
  41. short type;
  42. } names[] = {
  43. /* These must be sorted by eye for optimal hit rate */
  44. /* Add to this list only after substantial meditation */
  45. {"//", L_CC},
  46. {"template", L_CC},
  47. {"virtual", L_CC},
  48. {"class", L_CC},
  49. {"public:", L_CC},
  50. {"private:", L_CC},
  51. {"/*", L_C}, /* must precede "The", "the", etc. */
  52. {"#include", L_C},
  53. {"char", L_C},
  54. {"The", L_ENG},
  55. {"the", L_ENG},
  56. {"double", L_C},
  57. {"extern", L_C},
  58. {"float", L_C},
  59. {"real", L_C},
  60. {"struct", L_C},
  61. {"union", L_C},
  62. {"CFLAGS", L_MAKE},
  63. {"LDFLAGS", L_MAKE},
  64. {"all:", L_MAKE},
  65. {".PRECIOUS", L_MAKE},
  66. /* Too many files of text have these words in them. Find another way
  67. * to recognize Fortrash.
  68. */
  69. #ifdef NOTDEF
  70. {"subroutine", L_FORT},
  71. {"function", L_FORT},
  72. {"block", L_FORT},
  73. {"common", L_FORT},
  74. {"dimension", L_FORT},
  75. {"integer", L_FORT},
  76. {"data", L_FORT},
  77. #endif /*NOTDEF*/
  78. {".ascii", L_MACH},
  79. {".asciiz", L_MACH},
  80. {".byte", L_MACH},
  81. {".even", L_MACH},
  82. {".globl", L_MACH},
  83. {".text", L_MACH},
  84. {"clr", L_MACH},
  85. {"(input,", L_PAS},
  86. {"dcl", L_PLI},
  87. {"Received:", L_MAIL},
  88. {">From", L_MAIL},
  89. {"Return-Path:",L_MAIL},
  90. {"Cc:", L_MAIL},
  91. {"Newsgroups:", L_NEWS},
  92. {"Path:", L_NEWS},
  93. {"Organization:",L_NEWS},
  94. {NULL, 0}
  95. };
  96. #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)