1 // licenses.h written by Mitchell Foral. mitchell<att>caladbolg.net.
2 // See COPYING for license information.
4 #ifndef OHCOUNT_LICENSES_H
5 #define OHCOUNT_LICENSES_H
8 * @page license_doc License Documentation
9 * @author Mitchell Foral
11 * @section license How to Add a New License
13 * @li Add your license to 'src/licenses.h' and 'src/licenses.c'. Don't forget
14 * that two '\\'s are required to represent one '\\' in a C string.
15 * @li Add your tests to the 'test/src_licenses/' and 'test/expected_licenses/'
16 * directories. Note that multiple licenses must be separated by newlines and
17 * be in the order they appear in the input file.
18 * @li Run the test suite (a rebuild is not necessary; your added tests are
19 * detected and run automatically) to verify your licenses are correctly
21 * @li Rebuild Ohcount.
24 #include "sourcefile.h"
26 #define LIC_ACADEMIC "academic"
27 #define LIC_ADAPTIVE "adaptive"
28 #define LIC_AFFERO "affero"
29 #define LIC_APACHE "apache"
30 #define LIC_APACHE2 "apache_2"
31 #define LIC_APPLE_OPEN_SOURCE "apple_open_source"
32 #define LIC_ARTISTIC "artistic"
33 #define LIC_ATTRIBUTION_ASSURANCE "attribution_assurance"
34 #define LIC_BOOST "boost"
36 #define LIC_CECILL "cecill"
37 #define LIC_CECILL_B "cecill_b"
38 #define LIC_CECILL_C "cecill_c"
39 #define LIC_COMPUTER_ASSOCIATES_TRUSTED "computer_associates_trusted"
40 #define LIC_COMMON_DEVELOPMENT_AND_DISTRIBUTION \
41 "common_development_and_distribution"
42 #define LIC_COMMON_PUBLIC "common_public"
43 #define LIC_CUA_OFFICE "cua_office"
44 #define LIC_EU_DATAGRID "eu_datagrid"
45 #define LIC_ECLIPSE "eclipse"
46 #define LIC_EDUCATIONAL "educational"
47 #define LIC_EIFFEL "eiffel"
48 #define LIC_EIFFEL2 "eiffel_2"
49 #define LIC_ENTESSA "entessa"
50 #define LIC_FAIR "fair"
51 #define LIC_FRAMEWORX "frameworx"
52 #define LIC_GPL3_OR_LATER "gpl3_or_later"
53 #define LIC_GPL3 "gpl3"
54 #define LIC_LGPL3 "lgpl3"
56 #define LIC_LGPL "lgpl"
57 #define LIC_HISTORICAL "historical"
58 #define LIC_I9 "i9_license"
59 #define LIC_IBM_PUBLIC "ibm_public"
60 #define LIC_INTEL_OPEN_SOURCE "intel_open_source"
61 #define LIC_JABBER_OPEN_SOURCE "jabber_open_source"
62 #define LIC_LUCENT_PLAN9 "lucent_plan9"
63 #define LIC_LUCENT_PUBLIC "lucent_public"
65 #define LIC_MITRE "mitre"
66 #define LIC_MOTOSOTO "motosoto"
67 #define LIC_MOZILLA_PUBLIC1 "mozilla_public_1"
68 #define LIC_MOZILLA_PUBLIC11 "mozilla_public_1_1"
69 #define LIC_NASA_OPEN "nasa_open"
70 #define LIC_NAUMEN "naumen"
71 #define LIC_NETHACK "nethack"
72 #define LIC_NOKIA_OPEN_SOURCE "nokia_open_source"
73 #define LIC_OCLC_RESEARCH "oclc_research"
74 #define LIC_OPEN_GROUP_TEST "open_group_test"
75 #define LIC_OPEN_SOFTWARE "open_software"
76 #define LIC_PHP_LICENSE "php_license"
77 #define LIC_PYTHON_LICENSE "python_license"
78 #define LIC_PYTHON_SOFTWARE_FOUNDATION "python_software_foundation"
79 #define LIC_QT_PUBLIC "qt_public"
80 #define LIC_REALNETWORKS_PUBLIC_SOURCE "realnetworks_public_source"
81 #define LIC_RECIPROCAL_PUBLIC "reciprocal_public"
82 #define LIC_RICOH_SOURCE "ricoh_source"
83 #define LIC_SLEEPYCAT "sleepycat"
84 #define LIC_SUGARCRM113 "sugarcrm_1_1_3"
85 #define LIC_SUN_INDUSTRY_STANDARDS "sun_industry_standards"
86 #define LIC_SUN_PUBLIC "sun_public"
87 #define LIC_SYBASE_OPEN_WATCOM "sybase_open_watcom"
88 #define LIC_U_OF_I_NCSA "u_of_i_ncsa"
89 #define LIC_VOVIDA_SOFTWARE "vovida_software"
91 #define LIC_WXWINDOWS "wx_windows"
92 #define LIC_XNET "x_net"
93 #define LIC_ZOPE "zope"
94 #define LIC_ZLIB_LIBPNG "zlib_libpng"
95 #define LIC_APACHE_ISH "apache_ish"
96 #define LIC_BSD_ISH "bsd_ish"
97 #define LIC_BSD_2CLAUSE_ISH "bsd_2clause_ish"
98 #define LIC_WTFPL2 "wtfpl_2"
101 * Attempts to detect the source code licenses for a given file.
102 * It searches comment text in source files for any mention of known licenses,
103 * but unfortunately catches things like: "I find the GNU Public License dumb".
104 * @param sourcefile A SourceFile created by ohcount_sourcefile_new().
105 * @return LicenseList
107 LicenseList *ohcount_detect_license(SourceFile *sourcefile);
110 * Creates a new LicenseList that is initially empty.
111 * @return LicenseList
113 LicenseList *ohcount_license_list_new();
116 * Frees the memory allocated for the given LicenseList.
117 * @param list A LicenseList created from ohcount_license_list_new().
119 void ohcount_license_list_free(LicenseList *list);