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.
8 * Copyright (c) Ian F. Darwin, 1987.
9 * Written by Ian F. Darwin.
13 * $Id: names.h,v 1.18 2000/08/05 17:36:49 christos Exp $
17 modified by Chris Lowth - 9 April 2000
18 to add mime type strings to the types table.
21 /* these types are used to index the table 'types': keep em in sync! */
22 #define L_C 0 /* first and foremost on UNIX */
23 #define L_CC 1 /* Bjarne's postincrement */
24 #define L_FORT 2 /* the oldest one */
25 #define L_MAKE 3 /* Makefiles */
26 #define L_PLI 4 /* PL/1 */
27 #define L_MACH 5 /* some kinda assembler */
28 #define L_ENG 6 /* English */
29 #define L_PAS 7 /* Pascal */
30 #define L_MAIL 8 /* Electronic mail */
31 #define L_NEWS 9 /* Usenet Netnews */
32 #define L_JAVA 10 /* Java code */
33 #define L_HTML 11 /* HTML */
34 #define L_BCPL 12 /* BCPL */
35 #define L_M4 13 /* M4 */
41 { "C program", "text/x-c", },
42 { "C++ program", "text/x-c++" },
43 { "FORTRAN program", "text/x-fortran" },
44 { "make commands", "text/x-makefile" },
45 { "PL/1 program", "text/x-pl1" },
46 { "assembler program", "text/x-asm" },
47 { "English", "text/plain, English" },
48 { "Pascal program", "text/x-pascal" },
49 { "mail", "text/x-mail" },
50 { "news", "text/x-news" },
51 { "Java program", "text/x-java" },
52 { "HTML document", "text/html", },
53 { "BCPL program", "text/x-bcpl" },
54 { "M4 macro language pre-processor", "text/x-m4" },
55 { "can't happen error on names.h/types", "error/x-error" },
60 * XXX - how should we distinguish Java from C++?
61 * The trick used in a Debian snapshot, of having "extends" or "implements"
62 * as tags for Java, doesn't work very well, given that those keywords
63 * are often preceded by "class", which flags it as C++.
65 * Perhaps we need to be able to say
69 * if "extends" or "implements" then
75 * Or should we use other keywords, such as "package" or "import"?
76 * Unfortunately, Ada95 uses "package", and Modula-3 uses "import",
77 * although I infer from the language spec at
79 * http://www.research.digital.com/SRC/m3defn/html/m3.html
81 * that Modula-3 uses "IMPORT" rather than "import", i.e. it must be
84 * So, for now, we go with "import". We must put it before the C++
85 * stuff, so that we don't misidentify Java as C++. Not using "package"
86 * means we won't identify stuff that defines a package but imports
87 * nothing; hopefully, very little Java code imports nothing (one of the
88 * reasons for doing OO programming is to import as much as possible
89 * and write only what you need to, right?).
91 * Unfortunately, "import" may cause us to misidentify English text
92 * as Java, as it comes after "the" and "The". Perhaps we need a fancier
93 * heuristic to identify Java?
99 /* These must be sorted by eye for optimal hit rate */
100 /* Add to this list only after substantial meditation */
103 {"\"libhdr\"", L_BCPL},
104 {"\"LIBHDR\"", L_BCPL},
111 {"/*", L_C}, /* must precede "The", "the", etc. */
124 {".PRECIOUS", L_MAKE},
125 /* Too many files of text have these words in them. Find another way
126 * to recognize Fortrash.
129 {"subroutine", L_FORT},
130 {"function", L_FORT},
133 {"dimension", L_FORT},
146 {"Received:", L_MAIL},
148 {"Return-Path:",L_MAIL},
150 {"Newsgroups:", L_NEWS},
152 {"Organization:",L_NEWS},
159 #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)