summaryrefslogtreecommitdiff
path: root/dev-util/cccc
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/cccc')
-rw-r--r--dev-util/cccc/Manifest5
-rw-r--r--dev-util/cccc/cccc-3.1.5-r1.ebuild70
-rw-r--r--dev-util/cccc/files/cccc-MFC-dialect.opt21
-rw-r--r--dev-util/cccc/files/cccc-c_dialect.patch79
-rw-r--r--dev-util/cccc/metadata.xml19
5 files changed, 194 insertions, 0 deletions
diff --git a/dev-util/cccc/Manifest b/dev-util/cccc/Manifest
new file mode 100644
index 000000000000..c412bafe0f5e
--- /dev/null
+++ b/dev-util/cccc/Manifest
@@ -0,0 +1,5 @@
+AUX cccc-MFC-dialect.opt 560 BLAKE2B 65000ebbc99b306318aa2da34031879b7393649573b8509bc12ed6174d59208ea2a06e1af8d98eefb3d142d51e9b98bc9e2a058e8f8f3a68b17f76bb4dfcf6b2 SHA512 e37ded34821690e0b07e4e3da502bccdb5760a38a9f1fbacb6cec4de143cc9c0160684d9a41ce0c3ff8e2a7716889824594d6f8d374a631dbb0de91ccec53903
+AUX cccc-c_dialect.patch 2048 BLAKE2B d97bd8430fe1357779ebf221607ea724485cf5bf572c86f4adcb85ea6d29c41bfeeb562534bccd1787241c024951941921fe6936541c5ea1f72ea923e9612d12 SHA512 5fadc49a0da8ca51b74dd92e673b413b506c8b06dfeabb7da0e2ddf24e7766d58ebbcc00d018677f4b0ff77d10df8b974ff1afd4100c33152e8cad0538b61789
+DIST cccc-3.1.5.tar.gz 662760 BLAKE2B 57817ef9a44f002c017245d7dd3b1ef97fec59b59bce465d5e5e1cc12409b5602cfd8bf7ee938e526af9bcc11398639900d26848aa4f8c7f623669159de17117 SHA512 61544669a75ff7bd99c6ff5bb1e6ec163f2a09f4538493fe60e8f9f95eab7ba19ad6d39b6717ae010a223b8efe48c497a4feb8ead218e350ee2ab91b9c52c969
+EBUILD cccc-3.1.5-r1.ebuild 1589 BLAKE2B d884aa93f5f3ac2c971b65362b2ca1d35a51d316df45488f63dd2bb3e58fe79332c8bbb836350fd19915417b4c45c3eed158fe078f43df31db37efe00a4d20ab SHA512 1e47c296d5c116b4bdc642e6484e493086d0b35c3498ad0dda5d5245930b4c3b1b783d65628f3a93260b4df99ea469d10653929a1481aa1ec77ec8a0587dde0e
+MISC metadata.xml 694 BLAKE2B d8992216f3b05e4382fa843df2a71673946c1e81ef7325fef7ad39fa073c092cc86b1cd993582b40b230adb6902a406c30a7b9a00d557e7f2aafcf4e940e51cb SHA512 442e37fb776949e1f59ca7074ba1219e77e7e1be0003c5cace090342823227fca6a9a10ef607d133245985c717811005293bf2044fdb0bacfe2e114eea3ec2ad
diff --git a/dev-util/cccc/cccc-3.1.5-r1.ebuild b/dev-util/cccc/cccc-3.1.5-r1.ebuild
new file mode 100644
index 000000000000..a26523720d4b
--- /dev/null
+++ b/dev-util/cccc/cccc-3.1.5-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="Source metrics (line counts, complexity, etc) for Java and C++"
+HOMEPAGE="http://sarnold.github.io/cccc/"
+if [[ ${PV} = 9999* ]]; then
+ EGIT_REPO_URI="https://github.com/sarnold/cccc.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+else
+ SRC_URI="https://github.com/sarnold/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+fi
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="apidoc debug doc mfc"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ apidoc? ( app-doc/doxygen[dot] )
+ "
+
+src_prepare() {
+ is-flagq -flto* && filter-flags -flto* -fuse-linker-plugin
+ use mfc && eapply "${FILESDIR}"/${PN}-c_dialect.patch
+ default
+
+}
+
+src_compile() {
+ tc-export CC CXX LD AS AR NM RANLIB STRIP OBJCOPY
+ if use debug ; then
+ DEBUG="true" emake CCC=$(tc-getCXX) CC=$(tc-getCC) cccc
+ else
+ emake CCC=$(tc-getCXX) CC=$(tc-getCC) cccc
+ fi
+
+ use apidoc && emake CCC=$(tc-getCXX) metrics docs
+}
+
+src_test() {
+ emake CCC=$(tc-getCXX) test
+}
+
+src_install() {
+ dobin cccc/cccc
+
+ dodoc README.md
+
+ if use mfc ; then
+ insinto /usr/share/doc/${PF}
+ doins "${FILESDIR}"/cccc-MFC-dialect.opt
+ fi
+
+ if use doc ; then
+ insinto /usr/share/doc/${PF}/html
+ doins cccc/*.html || die "html docs failed"
+ if use apidoc ; then
+ insinto /usr/share/doc/${PF}/html/api
+ doins -r doxygen/html/* || die "dox failed"
+ insinto /usr/share/doc/${PF}/html/metrics
+ doins ccccout/* || die "metrics failed"
+ fi
+ fi
+}
diff --git a/dev-util/cccc/files/cccc-MFC-dialect.opt b/dev-util/cccc/files/cccc-MFC-dialect.opt
new file mode 100644
index 000000000000..4c4acb32e1fb
--- /dev/null
+++ b/dev-util/cccc/files/cccc-MFC-dialect.opt
@@ -0,0 +1,21 @@
+;;Pro*C embedded SQL
+;; looks like
+;; EXEC SQL UPDATE ARM43_OD_PRODUIT_SERV
+;; SET ARM43ID_TPS_FIN = NULL WHERE
+ARM43ID_TPS_FIN = 0;
+
+CCCC_FileExt@.pc@c++.ansi@
+
+CCCC_Dialect@c++.pc@EXEC@skip_stmt@
+
+;;MFC
+CCCC_Dialect@c++.mfc@ON_WM_PAINT@skip_line@
+CCCC_Dialect@c++.mfc@DECLARE_MESSAGE_MAP@skip_line@
+CCCC_Dialect@c++.mfc@DECLARE_DISPATCH_MAP@skip_line@
+
+CCCC_Dialect@c++.stl@__STL_BEGIN_NAMESPACE@ignore@
+CCCC_Dialect@c++.stl@__STL_END_NAMESPACE@ignore@
+
+CCCC_Dialect@c++.mfc@BEGIN_EVENT_MAP@start_skipping@
+CCCC_Dialect@c++.mfc@END_EVENT_MAP@stop_skipping@
+
diff --git a/dev-util/cccc/files/cccc-c_dialect.patch b/dev-util/cccc/files/cccc-c_dialect.patch
new file mode 100644
index 000000000000..c8951aef13c4
--- /dev/null
+++ b/dev-util/cccc/files/cccc-c_dialect.patch
@@ -0,0 +1,79 @@
+diff --git a/cccc/cccc.g b/cccc/cccc.g
+index bdb6805..fd7b504 100644
+--- a/cccc/cccc.g
++++ b/cccc/cccc.g
+@@ -84,6 +84,30 @@ inline void endOfLine(CLexer &lexer)
+ #token MAC_NL "\r" << endOfLine(*this); >>
+ #token UNIX_NL "\n" << endOfLine(*this); >>
+
++/* augment dialect policies -- M.H added */
++#lexclass SKIP_STMT
++#token SKCOLON ";" << skip();mode(START); >>
++#token SKANYTHING "~[; \t\n]" << skip();more();>>
++#token SKNL "\n" << skip();endOfLine(*this);>>
++#token SKBLANK "[ \t]+" << skip(); >>
++#lexclass START
++
++#lexclass SKIP_BLOCK
++#token SK_ANY "[a-zA-Z0-9_]*"
++<<
++std::string treatment =
++ CCCC_Options::dialectKeywordPolicy(parse_language,lextext());
++
++if ( treatment != "stop_skipping" )
++{
++ skip();
++}
++else
++{
++ mode(COMMENT_LINE);skip();
++}
++>>
++#lexclass START
+
+ /* preprocessor constructs - comments, #defines etc */
+
+@@ -343,17 +367,29 @@ inline void endOfLine(CLexer &lexer)
+ if( treatment == "ignore" )
+ {
+ skip();
++ //std::cout << toktext << std::endl <<" :ignore" << std::endl;
+ }
+ // Ultimately, the next two cases will need to be handled
+ // using a #lexclass or something similar, for the moment
+ // we just try to skip the tokens themselves.
+ else if ( treatment == "start_skipping" )
+ {
+- skip();
++ mode(SKIP_BLOCK);skip();
+ }
+ else if ( treatment == "stop_skipping" )
+ {
+- skip();
++ skip(); mode(COMMENT_LINE);
++ //gobble end of line M.H.
++ }
++ else if ( treatment == "skip_line" )//M.H added
++ {
++ mode(COMMENT_LINE);skip();
++ //std::cout << "skip_line" << std::endl;
++ }
++ else if ( treatment == "skip_stmt" )//M.H added
++ {
++ mode(SKIP_STMT);skip();
++ //std::cout << "skip_stmt" << std::endl;
+ }
+ >>
+
+@@ -426,8 +462,10 @@ void init(const string& filename, const string& language)
+ pu=ParseUtility::currentInstance();
+ ps=ParseStore::currentInstance();
+
+- ANTLRParser::init();
+ parse_language=language;
++ ANTLRParser::init();
++ //parse_language=language;
++ //move above, M.H.1st otherwise time init not to language
+ }
+
+ >>
diff --git a/dev-util/cccc/metadata.xml b/dev-util/cccc/metadata.xml
new file mode 100644
index 000000000000..ecde1cfd0a08
--- /dev/null
+++ b/dev-util/cccc/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>nerdboy@gentoo.org</email>
+ </maintainer>
+ <longdescription lang="en">
+ cccc provides source code metrics (line counts, complexity,
+ object-oriented, and structural metrics) for Java and C++
+ </longdescription>
+ <upstream>
+ <remote-id type="github">sarnold/cccc</remote-id>
+ <bugs-to>https://github.com/sarnold/cccc/issues</bugs-to>
+ </upstream>
+ <use>
+ <flag name="apidoc">Build software docs with doxygen/graphviz and metrics with cccc</flag>
+ <flag name="mfc">Add patch for MFC dialect options</flag>
+ </use>
+</pkgmetadata>