head	1.2;
access;
symbols
	RELENG_2_2_8_RELEASE:1.1
	RELENG_2_2_7_RELEASE:1.1
	RELENG_2_2_6_RELEASE:1.1
	RELENG_2_2_5_RELEASE:1.1
	RELENG_2_2_2_RELEASE:1.1
	RELENG_2_2_1_RELEASE:1.1
	RELENG_2_2_0_RELEASE:1.1
	RELENG_2_1_7_RELEASE:1.1
	RELENG_2_1_6_1_RELEASE:1.1
	RELENG_2_1_6_RELEASE:1.1
	RELENG_2_2:1.1.0.6
	RELENG_2_2_BP:1.1
	RELENG_2_1_5_RELEASE:1.1
	RELENG_2_1_0_RELEASE:1.1
	RELENG_2_1_0:1.1.0.4
	RELENG_2_1_0_BP:1.1
	RELENG_2_0_5_RELEASE:1.1
	RELENG_2_0_5:1.1.0.2
	RELENG_2_0_5_BP:1.1
	RELENG_2_0_5_ALPHA:1.1;
locks; strict;
comment	@# @;


1.2
date	98.09.09.06.49.31;	author markm;	state dead;
branches;
next	1.1;

1.1
date	95.03.24.04.33.51;	author jkh;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Old Perl is leaving us. Goodbye, faithful friend.
@
text
@#!/usr/bin/perl
while (<>) {
    if (/^\.SH SYNOPSIS/) {
	$spec = '';
	for ($_ = <>; $_ && !/^\.SH/; $_ = <>) {
	    s/^\.[IRB][IRB]\s*//;
	    s/^\.[IRB]\s+//;
	    next if /^\./;
	    s/\\f\w//g;
	    s/\\&//g;
	    s/^\s+//;
	    next if /^$/;
	    next if /^#/;
	    $spec .= $_;
	}
	$_ = $spec;
	0 while s/\(([^),;]*)\s*,\s*([^);]*)\)/($1|$2)/g;
	s/\(\*([^,;]*)\)\(\)/(*)()$1/g;
	s/(\w+)\[\]/*$1/g;

	s/\n/ /g;
	s/\s+/ /g;
	s/(\w+) \(([^*])/$1($2/g;
	s/^ //;
	s/ ?; ?/\n/g;
	s/\) /)\n/g;
	s/ \* / \*/g;
	s/\* / \*/g;

	$* = 1;
	0 while s/^((struct )?\w+ )([^\n,]*), ?(.*)/$1$3\n$1$4/g;
	$* = 0;
	s/\|/,/g;

	@@cases = ();
	for (reverse split(/\n/,$_)) {
	    if (/\)$/) {
		($type,$name,$args) = split(/(\w+)\(/);
		$type =~ s/ $//;
		if ($type =~ /^(\w+) =/) {
		    $type = $type{$1} if $type{$1};
		}
		$type = 'int' if $type eq '';
		@@args = grep(/./, split(/[,)]/,$args));
		$case = "CASE $type $name\n";
		foreach $arg (@@args) {
		    $type = $type{$arg} || "int";
		    $type =~ s/ //g;
		    $type .= "\t" if length($type) < 8;
		    if ($type =~ /\*/) {
			$case .= "IO	$type	$arg\n";
		    }
		    else {
			$case .= "I	$type	$arg\n";
		    }
		}
		$case .= "END\n\n";
		unshift(@@cases, $case);
	    }
	    else {
		$type{$name} = $type if ($type,$name) = /(.*\W)(\w+)$/;
	    }
	}
	print @@cases;
    }
}
@


1.1
log
@Bring back perl/usub as usub/, this time containing an updated curseperl
which is also installed by default (the reason for which should also be
plain shortly).
@
text
@@
