head     1.3;
branch   ;
access   ;
symbols  ;
locks    lee:1.3;
comment  @# @;


1.3
date     95.10.10.00.04.37;  author lee;  state Exp;
branches ;
next     1.2;

1.2
date     95.10.10.00.00.59;  author lee;  state Exp;
branches ;
next     1.1;

1.1
date     95.10.10.00.00.41;  author lee;  state Exp;
branches ;
next     ;


desc
@get the documentation out of one C file...
@


1.3
log
@speedups.
@
text
@#! /usr/local/bin/perl -w

# called by bin/mkdocfromc.
# $Id$

while (<>) {
    if (/<Function>/ .. /^{/) {
	if (/\/\*ARGSUSED[0-9]*\*\//) {
	    next;
	}

	if (/^{/) {
	    s@@^{@@</Decl>@@;
	    print;
	    next;
	}

	if (/^ *\*\//) {
	    s@@^ *\*/ *@@<Decl>@@;
	    print;
	    next;
	}

	s@@^/\* *@@@@; # delete the comment open 

	# keep leading whitespace only within examples:
	if (/<Example/i .. /<\/example/i) {
	    if (/<\/*Example/i) {
		# the actual tag lines are normal...
		s@@^[ 	]*\*[ 	]*@@@@;
	    } else {
		# but within an example,
		# delete only <space> <star> <tab>
		s@@^ \*\t@@@@;
	    }
	} else {
	    if (/<Name>.*[^>]$/) {
		s@@$@@</Name>@@;
	    } else {
		s/<Function/<Function File="$ARGV"/;
	    }
	    s@@^[ 	]*\*[ 	]*@@@@;
	}
	s/<([a-z][a-z0-9]*\.h)>/\&lt;$1\&gt;/g;
	print;
    }
}
@


1.2
log
@special handling for examples.
@
text
@d12 5
a16 3
	s@@^{@@</Decl>@@;
	s@@^ *\*/ *@@<Decl>@@;
	s@@^/\* *@@@@; # delete the comment open 
d18 4
a21 2
	if (/<Name>.*[^>]$/) {
	    s@@$@@</Name>@@;
d24 2
d37 5
a44 1
	s/<Function/<Function File="$ARGV"/;
@


1.1
log
@Initial revision
@
text
@d4 1
d14 2
a15 1
	s@@^/\* *@@@@;
d19 14
a32 1
	s@@^[ 	]*\*[ 	]*@@@@;
@
