168349Sobrien#------------------------------------------------------------------------------
2267843Sdelphij# $File: c-lang,v 1.19 2014/06/03 19:17:27 christos Exp $
3234250Sobrien# c-lang:  file(1) magic for C and related languages programs
468349Sobrien#
568349Sobrien
6234250Sobrien# BCPL
7234250Sobrien0	search/8192	"libhdr"	BCPL source text
8234250Sobrien!:mime	text/x-bcpl
9234250Sobrien0	search/8192	"LIBHDR"	BCPL source text
10234250Sobrien!:mime	text/x-bcpl
1168349Sobrien
12234250Sobrien# C
13234250Sobrien0	regex	\^#include	C source text
14234250Sobrien!:mime	text/x-c
15267843Sdelphij0	regex	\^char[\ \t\n]+	C source text
16234250Sobrien!:mime	text/x-c
17267843Sdelphij0	regex	\^double[\ \t\n]+		C source text
18234250Sobrien!:mime	text/x-c
19267843Sdelphij0	regex	\^extern[\ \t\n]+		C source text
20234250Sobrien!:mime	text/x-c
21267843Sdelphij0	regex	\^float[\ \t\n]+		C source text
22234250Sobrien!:mime	text/x-c
23267843Sdelphij0	regex	\^struct[\ \t\n]+		C source text
24234250Sobrien!:mime	text/x-c
25267843Sdelphij0	regex	\^union[\ \t\n]+		C source text
26234250Sobrien!:mime	text/x-c
27234250Sobrien0	search/8192	main(		C source text
28234250Sobrien!:mime	text/x-c
29186690Sobrien
30234250Sobrien# C++
31234250Sobrien# The strength of these rules is increased so they beat the C rules above
32267843Sdelphij0	regex	\^template[\ \t\n]+	C++ source text
33267843Sdelphij!:strength + 5
34234250Sobrien!:mime	text/x-c++
35267843Sdelphij0	regex	\^virtual[\ \t\n]+		C++ source text
36267843Sdelphij!:strength + 5
37234250Sobrien!:mime	text/x-c++
38267843Sdelphij0	regex	\^class[\ \t\n]+		C++ source text
39267843Sdelphij!:strength + 5
40234250Sobrien!:mime	text/x-c++
41234250Sobrien0	regex	\^public:		C++ source text
42267843Sdelphij!:strength + 5
43234250Sobrien!:mime	text/x-c++
44234250Sobrien0	regex	\^private:		C++ source text
45267843Sdelphij!:strength + 5
46234250Sobrien!:mime	text/x-c++
47133359Sobrien
48133359Sobrien# From: Mikhail Teterin <mi@aldan.algebra.com> 
49133359Sobrien0	string		cscope		cscope reference data
50133359Sobrien>7	string		x		version %.2s
51133359Sobrien# We skip the path here, because it is often long (so file will
52133359Sobrien# truncate it) and mostly redundant.
53267843Sdelphij# The inverted index functionality was added some time between
54133359Sobrien# versions 11 and 15, so look for -q if version is above 14:
55133359Sobrien>7	string		>14
56186690Sobrien>>10	search/100	\ -q\ 		with inverted index
57186690Sobrien>10	search/100	\ -c\ 		text (non-compressed)
58