Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Feb 1998 11:17:37 +0900 (JST)
From:      Michael Hancock <michaelh@cet.co.jp>
To:        FreeBSD Hackers <Hackers@FreeBSD.ORG>
Subject:   cshort - speaking of new utilities
Message-ID:  <Pine.SV4.3.95.980226104716.1660A-100000@parkplace.cet.co.jp>
In-Reply-To: <01BD4207.4AA87440.meuston@jmrodgers.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Has anyone written something like cshort?

Basically, cshort is filter you apply to C files to give you shortened
views of the file.  You specify different levels of detail.

For example, level 0 just returns the source unchanged and level 1 returns
only the function signatures.

cshort -L 1 foo.c
--------------------
int
foobar1(a)
	int a;

int
foobar2(a)
	int a;
--------------------

Level 2 returns pre-conditions and post-conditions.  You could probably
make a .cshortrc to specify what these look like.

cshort -L 2 foo.c
--------------------
int
foobar(a)
	int a;
	REQUIRE(a > 0);
	ENSURE(retval < 100);

int
foobar(a)
	int a;
	REQUIRE(a > 1);

Level 3 returns all of the above plus comments.

cshort -L 3 foo.c
-----------------------
/*
 * My foobar prog...
 */
int
foobar(a)
	int a;
	/*
	 * Pre-condition
	 */
	REQUIRE(a>0);
	/*
	 * Calculate the N-Cube graphical inverse vortex.
	 */
	/*
	 * Post-condition
	 */
	ENSURE(retval < 100);

For Freebsd, you might add an option to skip the first comment which is
usually a long copyright.

This is from the Eiffel programming environment, but I think the idea is
pretty useful for C.

Regards,


Mike Hancock
--
michaelh@cet.co.jp                                http://www.cet.co.jp
CET Inc., Daiichi Kasuya BLDG 8F, 2-5-12 Higashi Shinbashi, Minato-ku,
Tokyo 105 Japan              Tel: +81-3-3437-1761 Fax: +81-3-3437-1766


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.95.980226104716.1660A-100000>