names.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #define L_JAVA 10 /* Java code */
  27. #define L_HTML 11 /* HTML */
  28. static const char *types[] = {
  29. "C program text",
  30. "C++ program text",
  31. "FORTRAN program text",
  32. "make commands text" ,
  33. "PL/1 program text",
  34. "assembler program text",
  35. "English text",
  36. "Pascal program text",
  37. "mail text",
  38. "news text",
  39. "Java program text",
  40. "HTML document text",
  41. "can't happen error on names.h/types",
  42. 0};
  43. static struct names {
  44. const char *name;
  45. short type;
  46. } names[] = {
  47. /* These must be sorted by eye for optimal hit rate */
  48. /* Add to this list only after substantial meditation */
  49. {"//", L_CC},
  50. {"template", L_CC},
  51. {"virtual", L_CC},
  52. {"class", L_CC},
  53. {"public:", L_CC},
  54. {"private:", L_CC},
  55. {"/*", L_C}, /* must precede "The", "the", etc. */
  56. {"#include", L_C},
  57. {"char", L_C},
  58. {"The", L_ENG},
  59. {"the", L_ENG},
  60. {"double", L_C},
  61. {"extern", L_C},
  62. {"float", L_C},
  63. {"real", L_C},
  64. {"struct", L_C},
  65. {"union", L_C},
  66. {"CFLAGS", L_MAKE},
  67. {"LDFLAGS", L_MAKE},
  68. {"all:", L_MAKE},
  69. {".PRECIOUS", L_MAKE},
  70. /* Too many files of text have these words in them. Find another way
  71. * to recognize Fortrash.
  72. */
  73. #ifdef NOTDEF
  74. {"subroutine", L_FORT},
  75. {"function", L_FORT},
  76. {"block", L_FORT},
  77. {"common", L_FORT},
  78. {"dimension", L_FORT},
  79. {"integer", L_FORT},
  80. {"data", L_FORT},
  81. #endif /*NOTDEF*/
  82. {".ascii", L_MACH},
  83. {".asciiz", L_MACH},
  84. {".byte", L_MACH},
  85. {".even", L_MACH},
  86. {".globl", L_MACH},
  87. {".text", L_MACH},
  88. {"clr", L_MACH},
  89. {"(input,", L_PAS},
  90. {"dcl", L_PLI},
  91. {"Received:", L_MAIL},
  92. {">From", L_MAIL},
  93. {"Return-Path:",L_MAIL},
  94. {"Cc:", L_MAIL},
  95. {"Newsgroups:", L_NEWS},
  96. {"Path:", L_NEWS},
  97. {"Organization:",L_NEWS},
  98. {"extends", L_JAVA},
  99. {"implements", L_JAVA},
  100. {"href=", L_HTML},
  101. {"HREF=", L_HTML},
  102. {"<body", L_HTML},
  103. {"<BODY", L_HTML},
  104. {NULL, 0}
  105. };
  106. #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)