c-lang 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #------------------------------------------------------------------------------
  2. # $File: c-lang,v 1.24 2016/07/01 23:31:13 christos Exp $
  3. # c-lang: file(1) magic for C and related languages programs
  4. #
  5. # The strength is to beat standard HTML
  6. # BCPL
  7. 0 search/8192 "libhdr" BCPL source text
  8. !:mime text/x-bcpl
  9. 0 search/8192 "LIBHDR" BCPL source text
  10. !:mime text/x-bcpl
  11. # C
  12. 0 regex \^#include C source text
  13. !:strength +25
  14. !:mime text/x-c
  15. 0 regex \^char[\ \t\n]+ C source text
  16. !:mime text/x-c
  17. 0 regex \^double[\ \t\n]+ C source text
  18. !:mime text/x-c
  19. 0 regex \^extern[\ \t\n]+ C source text
  20. !:mime text/x-c
  21. 0 regex \^float[\ \t\n]+ C source text
  22. !:mime text/x-c
  23. 0 regex \^struct[\ \t\n]+ C source text
  24. !:mime text/x-c
  25. 0 regex \^union[\ \t\n]+ C source text
  26. !:mime text/x-c
  27. 0 search/8192 main( C source text
  28. !:mime text/x-c
  29. # C++
  30. # The strength of these rules is increased so they beat the C rules above
  31. 0 regex \^template[\ \t]+<.*>[\ \t\n]+ C++ source text
  32. !:strength + 30
  33. !:mime text/x-c++
  34. 0 regex \^virtual[\ \t\n]+ C++ source text
  35. !:strength + 30
  36. !:mime text/x-c++
  37. 0 regex \^class[\ \t\n]+ C++ source text
  38. # But class is reduced to avoid beating php (Jens Schleusener)
  39. !:strength + 13
  40. !:mime text/x-c++
  41. 0 regex \^public: C++ source text
  42. !:strength + 30
  43. !:mime text/x-c++
  44. 0 regex \^private: C++ source text
  45. !:strength + 30
  46. !:mime text/x-c++
  47. # Objective-C
  48. 0 regex \^#import Objective-C source text
  49. !:strength +25
  50. !:mime text/x-objective-c
  51. # From: Mikhail Teterin <mi@aldan.algebra.com>
  52. 0 string cscope cscope reference data
  53. >7 string x version %.2s
  54. # We skip the path here, because it is often long (so file will
  55. # truncate it) and mostly redundant.
  56. # The inverted index functionality was added some time between
  57. # versions 11 and 15, so look for -q if version is above 14:
  58. >7 string >14
  59. >>10 search/100 \ -q\ with inverted index
  60. >10 search/100 \ -c\ text (non-compressed)