c-lang revision 303975
1190214Srpaulo#------------------------------------------------------------------------------ 2190214Srpaulo# $File: c-lang,v 1.23 2016/05/21 14:28:27 christos Exp $ 3190214Srpaulo# c-lang: file(1) magic for C and related languages programs 4190214Srpaulo# 5190214Srpaulo# The strength is to beat standard HTML 6190214Srpaulo 7190214Srpaulo# BCPL 8190214Srpaulo0 search/8192 "libhdr" BCPL source text 9190214Srpaulo!:mime text/x-bcpl 10190214Srpaulo0 search/8192 "LIBHDR" BCPL source text 11190214Srpaulo!:mime text/x-bcpl 12190214Srpaulo 13190214Srpaulo# C 14190214Srpaulo0 regex \^#include C source text 15190214Srpaulo!:strength +25 16190214Srpaulo!:mime text/x-c 17190214Srpaulo0 regex \^char[\ \t\n]+ C source text 18190214Srpaulo!:mime text/x-c 19190214Srpaulo0 regex \^double[\ \t\n]+ C source text 20276768Sdelphij!:mime text/x-c 21190214Srpaulo0 regex \^extern[\ \t\n]+ C source text 22190214Srpaulo!:mime text/x-c 23190214Srpaulo0 regex \^float[\ \t\n]+ C source text 24190214Srpaulo!:mime text/x-c 25190214Srpaulo0 regex \^struct[\ \t\n]+ C source text 26190214Srpaulo!:mime text/x-c 27190214Srpaulo0 regex \^union[\ \t\n]+ C source text 28190214Srpaulo!:mime text/x-c 29190214Srpaulo0 search/8192 main( C source text 30190214Srpaulo!:mime text/x-c 31190214Srpaulo 32190214Srpaulo# C++ 33190214Srpaulo# The strength of these rules is increased so they beat the C rules above 34190214Srpaulo0 regex \^template[\ \t]+<.*>[\ \t\n]+ C++ source text 35190214Srpaulo!:strength + 30 36190214Srpaulo!:mime text/x-c++ 37190214Srpaulo0 regex \^virtual[\ \t\n]+ C++ source text 38190214Srpaulo!:strength + 30 39190214Srpaulo!:mime text/x-c++ 40190214Srpaulo0 regex \^class[\ \t\n]+ C++ source text 41190214Srpaulo# But class is reduced to avoid beating php (Jens Schleusener) 42190214Srpaulo!:strength + 13 43190214Srpaulo!:mime text/x-c++ 44235426Sdelphij0 regex \^public: C++ source text 45235426Sdelphij!:strength + 30 46235426Sdelphij!:mime text/x-c++ 47235426Sdelphij0 regex \^private: C++ source text 48235426Sdelphij!:strength + 30 49190214Srpaulo!:mime text/x-c++ 50190214Srpaulo 51190214Srpaulo# From: Mikhail Teterin <mi@aldan.algebra.com> 52190214Srpaulo0 string cscope cscope reference data 53190214Srpaulo>7 string x version %.2s 54190214Srpaulo# We skip the path here, because it is often long (so file will 55190214Srpaulo# truncate it) and mostly redundant. 56190214Srpaulo# The inverted index functionality was added some time between 57190214Srpaulo# versions 11 and 15, so look for -q if version is above 14: 58235426Sdelphij>7 string >14 59235426Sdelphij>>10 search/100 \ -q\ with inverted index 60235426Sdelphij>10 search/100 \ -c\ text (non-compressed) 61190214Srpaulo