From owner-freebsd-hackers Wed Feb 25 18:18:28 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA29826 for freebsd-hackers-outgoing; Wed, 25 Feb 1998 18:18:28 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from parkplace.cet.co.jp (parkplace.cet.co.jp [202.32.64.1]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA29776 for ; Wed, 25 Feb 1998 18:18:19 -0800 (PST) (envelope-from michaelh@cet.co.jp) Received: from localhost (michaelh@localhost) by parkplace.cet.co.jp (8.8.8/CET-v2.2) with SMTP id CAA02088 for ; Thu, 26 Feb 1998 02:17:37 GMT Date: Thu, 26 Feb 1998 11:17:37 +0900 (JST) From: Michael Hancock To: FreeBSD Hackers Subject: cshort - speaking of new utilities In-Reply-To: <01BD4207.4AA87440.meuston@jmrodgers.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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