1 // detector.h written by Mitchell Foral. mitchell<att>caladbolg.net.
2 // See COPYING for license information.
4 #ifndef OHCOUNT_DETECTOR_H
5 #define OHCOUNT_DETECTOR_H
8 * @page detector_doc Detector Documentation
10 * @section language How to Add a New Language
12 * @li Add your language to 'src/languages.h' and 'src/hash/languages.gperf'.
13 * @li Update 'src/hash/extensions.gperf' to identify files that use the new
14 * language (or 'src/hash/filenames.gperf').
15 * @li Regenerate the hash header files with 'src/hash/generate_headers'.
16 * @li Add your tests to 'test/unit/detector_test.h', rebuild the tests, and
17 * run them to confirm the detector changes.
18 * @li Follow the detailed instructions in the Parser Documentation.
19 * @li Rebuild Ohcount.
22 #include "sourcefile.h"
25 * Attempts to detect the programming language used by the given file.
26 * The returned pointer is used internally and must not be 'free'd.
27 * @param sourcefile A SourceFile created by ohcount_sourcefile_new().
28 * @return pointer to a string with the detected language or NULL.
30 const char *ohcount_detect_language(SourceFile *sourcefile);
32 int ohcount_is_binary_filename(const char *filename);