Examining the source for ohcountohcount provided by ED1TORby 3D1T0R, there are various ways that are used. Specifically, for C and Fortran, extensions.gperf shows that for "LANG_C" the file extension "c" is sufficient to identity the programming language. Whereas for the file extensions for "fortran" the file extension can be ambiguous:
c, LANG_C
...
f, DISAMBIGUATE("fortran")
f03, DISAMBIGUATE("fortran")
f08, DISAMBIGUATE("fortran")
f77, DISAMBIGUATE("fortran")
f90, DISAMBIGUATE("fortran")
f95, DISAMBIGUATE("fortran")
for, DISAMBIGUATE("fortran")
fpp, DISAMBIGUATE("fortran")
ftn, DISAMBIGUATE("fortran")
Within detector.c the disambiguate_fortran()
function returns either LANG_FORTRANFREE
or LANG_FORTRANFIXED
:
// Try the assumption of a fixed formatted source code, and return free
// format if anything opposes this assumption.
For other languages the above two links can be examined.