summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
authorBruce M Simpson <bms@FreeBSD.org>2004-03-02 09:05:14 +0000
committerBruce M Simpson <bms@FreeBSD.org>2004-03-02 09:05:14 +0000
commitba73e138817ba9e3aaa437473051b862bee99200 (patch)
tree321d0b5e87579f906650969c249ca5faa9fcec15 /devel
parent- Fix segfaults (diff)
c2mdoc is an awk/shell script wot I wrote to aid in documenting our many
wonderful kernel APIs. c2man seems to choke on tcp_subr.c (which I was using as a baseline), so let's do it the long way round instead. This script spits out mdoc(7) markup ready for pasting into the SYNOPSIS section of our wonderful mdoc.template.
Notes
Notes: svn path=/head/; revision=102705
Diffstat (limited to 'devel')
-rw-r--r--devel/Makefile1
-rw-r--r--devel/c2mdoc/Makefile34
-rw-r--r--devel/c2mdoc/distinfo1
-rw-r--r--devel/c2mdoc/files/c2mdoc15
-rw-r--r--devel/c2mdoc/files/c2mdoc.awk13
-rw-r--r--devel/c2mdoc/pkg-descr8
6 files changed, 72 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile
index 432e14ea3586..f7b4c07a0a43 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -90,6 +90,7 @@
SUBDIR += byaccj
SUBDIR += c2lib
SUBDIR += c2man
+ SUBDIR += c2mdoc
SUBDIR += c4
SUBDIR += c_c++_reference
SUBDIR += c_parser
diff --git a/devel/c2mdoc/Makefile b/devel/c2mdoc/Makefile
new file mode 100644
index 000000000000..09b8f2c67d80
--- /dev/null
+++ b/devel/c2mdoc/Makefile
@@ -0,0 +1,34 @@
+# New ports collection makefile for: c2mdoc
+# Date created: 2 March 2004
+# Whom: Bruce M. Simpson <bms@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= c2mdoc
+PORTVERSION= 20040302
+CATEGORIES= devel textproc
+MASTER_SITES= #
+DISTFILES=
+
+MAINTAINER= bms@FreeBSD.org
+COMMENT= Script to generate mdoc(7) markup from C functions
+
+RUN_DEPENDS= cproto:${PORTSDIR}/devel/cproto
+
+NOMAN=
+
+USE_REINPLACE= yes
+NO_BUILD= yes
+NO_WRKSUBDIR= yes
+
+PKG_PLIST= bin/c2mdoc libexec/c2mdoc.awk
+
+do-install:
+ ${INSTALL_SCRIPT} ${FILESDIR}/c2mdoc.awk ${PREFIX}/libexec
+ ${CP} ${FILESDIR}/c2mdoc ${WRKDIR}
+ ${REINPLACE_CMD} -e "s|%%LIBEXECDIR%%|${PREFIX}/libexec|g;" \
+ ${WRKDIR}/c2mdoc
+ ${INSTALL_SCRIPT} ${WRKDIR}/c2mdoc ${PREFIX}/bin
+
+.include <bsd.port.mk>
diff --git a/devel/c2mdoc/distinfo b/devel/c2mdoc/distinfo
new file mode 100644
index 000000000000..792d6005489e
--- /dev/null
+++ b/devel/c2mdoc/distinfo
@@ -0,0 +1 @@
+#
diff --git a/devel/c2mdoc/files/c2mdoc b/devel/c2mdoc/files/c2mdoc
new file mode 100644
index 000000000000..245e8687b054
--- /dev/null
+++ b/devel/c2mdoc/files/c2mdoc
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# c2mdoc -- Front-end which abuses the cproto parser to spit out
+# mdoc(7) format prototypes for use in FreeBSD documentation.
+#
+
+AWKSCRIPT="%%LIBEXECDIR%%/c2mdoc.awk"
+CPROTO='-P"int\tf\t(\ta\t,\tb\t)" -pq -f3'
+CPROTO_BIN=cproto
+export CPROTO
+
+${CPROTO_BIN} $1 | \
+ grep -v '/\*.*\*/' | \
+ sed -e 's/[,();]//g' | \
+ ${AWKSCRIPT}
diff --git a/devel/c2mdoc/files/c2mdoc.awk b/devel/c2mdoc/files/c2mdoc.awk
new file mode 100644
index 000000000000..5bf92fecbc11
--- /dev/null
+++ b/devel/c2mdoc/files/c2mdoc.awk
@@ -0,0 +1,13 @@
+#!/usr/bin/awk -f
+#
+# c2mdoc.awk -- Takes tabulated output from cproto(1) and turns it into
+# mdoc(7) markup.
+#
+BEGIN { FS="\t" }
+{
+ printf ".Fa %s\n", $1 ;
+ printf ".Fn %s", $2 ;
+ for (i = 4; i < NF; i++)
+ printf " \"%s\"", $i
+ printf "\n" ;
+}
diff --git a/devel/c2mdoc/pkg-descr b/devel/c2mdoc/pkg-descr
new file mode 100644
index 000000000000..6693f22bb06a
--- /dev/null
+++ b/devel/c2mdoc/pkg-descr
@@ -0,0 +1,8 @@
+c2mdoc is a shell and awk script wrapper which abuses devel/cproto's parser
+to spit out function prototypes in a format ready to paste into FreeBSD
+developer documentation. c2man already claims to do such a thing, but seems
+crippled in the face of our kernel source. The toolchain used by this port
+whinges but still generates markup.
+
+Bruce
+bms@FreeBSD.org