NetBSD/usr.bin/file/names.h

102 lines
2.5 KiB
C
Raw Normal View History

1997-09-30 21:00:30 +04:00
/* $NetBSD: names.h,v 1.7 1997/09/30 17:00:45 is Exp $ */
1997-01-09 23:18:21 +03:00
1993-03-21 12:45:37 +03:00
/*
* Names.h - names and types used by ascmagic in file(1).
* These tokens are here because they can appear anywhere in
1997-09-30 21:00:30 +04:00
* the first HOWMANY bytes, while tokens in MAGIC must
1993-03-21 12:45:37 +03:00
* appear at fixed offsets into the file. Don't make HOWMANY
* too high unless you have a very fast CPU.
*
* Copyright (c) Ian F. Darwin, 1987.
* Written by Ian F. Darwin.
*
* See LEGAL.NOTICE
1993-03-21 12:45:37 +03:00
*
1997-09-30 21:00:30 +04:00
* $NetBSD: names.h,v 1.7 1997/09/30 17:00:45 is Exp $
1993-03-21 12:45:37 +03:00
*/
/* these types are used to index the table 'types': keep em in sync! */
#define L_C 0 /* first and foremost on UNIX */
1997-01-28 03:49:36 +03:00
#define L_CC 1 /* Bjarne's postincrement */
#define L_FORT 2 /* the oldest one */
#define L_MAKE 3 /* Makefiles */
#define L_PLI 4 /* PL/1 */
#define L_MACH 5 /* some kinda assembler */
#define L_ENG 6 /* English */
#define L_PAS 7 /* Pascal */
#define L_MAIL 8 /* Electronic mail */
#define L_NEWS 9 /* Usenet Netnews */
1993-03-21 12:45:37 +03:00
static char *types[] = {
1995-04-28 23:23:38 +04:00
"C program text",
1997-01-28 03:49:36 +03:00
"C++ program text",
1995-04-28 23:23:38 +04:00
"FORTRAN program text",
1993-03-21 12:45:37 +03:00
"make commands text" ,
1995-04-28 23:23:38 +04:00
"PL/1 program text",
1993-03-21 12:45:37 +03:00
"assembler program text",
"English text",
1995-04-28 23:23:38 +04:00
"Pascal program text",
1993-03-21 12:45:37 +03:00
"mail text",
"news text",
"can't happen error on names.h/types",
0};
static struct names {
1993-03-21 12:45:37 +03:00
char *name;
short type;
} names[] = {
/* These must be sorted by eye for optimal hit rate */
/* Add to this list only after substantial meditation */
1997-01-28 03:49:36 +03:00
{"//", L_CC},
{"template", L_CC},
{"virtual", L_CC},
{"class", L_CC},
{"public:", L_CC},
{"private:", L_CC},
1995-04-28 23:23:38 +04:00
{"/*", L_C}, /* must precede "The", "the", etc. */
1993-03-21 12:45:37 +03:00
{"#include", L_C},
{"char", L_C},
{"The", L_ENG},
{"the", L_ENG},
{"double", L_C},
{"extern", L_C},
{"float", L_C},
{"real", L_C},
{"struct", L_C},
{"union", L_C},
{"CFLAGS", L_MAKE},
{"LDFLAGS", L_MAKE},
{"all:", L_MAKE},
{".PRECIOUS", L_MAKE},
/* Too many files of text have these words in them. Find another way
* to recognize Fortrash.
*/
#ifdef NOTDEF
{"subroutine", L_FORT},
{"function", L_FORT},
{"block", L_FORT},
{"common", L_FORT},
{"dimension", L_FORT},
{"integer", L_FORT},
{"data", L_FORT},
#endif /*NOTDEF*/
{".ascii", L_MACH},
{".asciiz", L_MACH},
{".byte", L_MACH},
{".even", L_MACH},
{".globl", L_MACH},
1995-04-28 23:23:38 +04:00
{".text", L_MACH},
1993-03-21 12:45:37 +03:00
{"clr", L_MACH},
{"(input,", L_PAS},
{"dcl", L_PLI},
{"Received:", L_MAIL},
{">From", L_MAIL},
{"Return-Path:",L_MAIL},
{"Cc:", L_MAIL},
{"Newsgroups:", L_NEWS},
{"Path:", L_NEWS},
{"Organization:",L_NEWS},
1995-03-26 01:35:28 +03:00
{NULL, 0}
};
1993-03-21 12:45:37 +03:00
#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)