file_cmds-60.tar.gz
[apple/file_cmds.git] / file / names.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.1 (the "License"). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
12 * this file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
20 * under the License.
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24 /* $OpenBSD: names.h,v 1.3 1997/02/09 23:58:29 millert Exp $ */
25
26 /*
27 * Names.h - names and types used by ascmagic in file(1).
28 * These tokens are here because they can appear anywhere in
29 * the first HOWMANY bytes, while tokens in /etc/magic must
30 * appear at fixed offsets into the file. Don't make HOWMANY
31 * too high unless you have a very fast CPU.
32 *
33 * Copyright (c) Ian F. Darwin, 1987.
34 * Written by Ian F. Darwin.
35 *
36 * See LEGAL.NOTICE
37 */
38
39 /* these types are used to index the table 'types': keep em in sync! */
40 #define L_C 0 /* first and foremost on UNIX */
41 #define L_CC 1 /* Bjarne's postincrement */
42 #define L_FORT 2 /* the oldest one */
43 #define L_MAKE 3 /* Makefiles */
44 #define L_PLI 4 /* PL/1 */
45 #define L_MACH 5 /* some kinda assembler */
46 #define L_ENG 6 /* English */
47 #define L_PAS 7 /* Pascal */
48 #define L_MAIL 8 /* Electronic mail */
49 #define L_NEWS 9 /* Usenet Netnews */
50
51 static char *types[] = {
52 "C program text",
53 "C++ program text",
54 "FORTRAN program text",
55 "make commands text" ,
56 "PL/1 program text",
57 "assembler program text",
58 "English text",
59 "Pascal program text",
60 "mail text",
61 "news text",
62 "can't happen error on names.h/types",
63 0};
64
65 static struct names {
66 char *name;
67 short type;
68 } names[] = {
69 /* These must be sorted by eye for optimal hit rate */
70 /* Add to this list only after substantial meditation */
71 {"//", L_CC},
72 {"template", L_CC},
73 {"virtual", L_CC},
74 {"class", L_CC},
75 {"public:", L_CC},
76 {"private:", L_CC},
77 {"/*", L_C}, /* must precede "The", "the", etc. */
78 {"#include", L_C},
79 {"char", L_C},
80 {"The", L_ENG},
81 {"the", L_ENG},
82 {"double", L_C},
83 {"extern", L_C},
84 {"float", L_C},
85 {"real", L_C},
86 {"struct", L_C},
87 {"union", L_C},
88 {"CFLAGS", L_MAKE},
89 {"LDFLAGS", L_MAKE},
90 {"all:", L_MAKE},
91 {".PRECIOUS", L_MAKE},
92 /* Too many files of text have these words in them. Find another way
93 * to recognize Fortrash.
94 */
95 #ifdef NOTDEF
96 {"subroutine", L_FORT},
97 {"function", L_FORT},
98 {"block", L_FORT},
99 {"common", L_FORT},
100 {"dimension", L_FORT},
101 {"integer", L_FORT},
102 {"data", L_FORT},
103 #endif /*NOTDEF*/
104 {".ascii", L_MACH},
105 {".asciiz", L_MACH},
106 {".byte", L_MACH},
107 {".even", L_MACH},
108 {".globl", L_MACH},
109 {".text", L_MACH},
110 {"clr", L_MACH},
111 {"(input,", L_PAS},
112 {"dcl", L_PLI},
113 {"Received:", L_MAIL},
114 {">From", L_MAIL},
115 {"Return-Path:",L_MAIL},
116 {"Cc:", L_MAIL},
117 {"Newsgroups:", L_NEWS},
118 {"Path:", L_NEWS},
119 {"Organization:",L_NEWS},
120 {NULL, 0}
121 };
122 #define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)