From 46d955832a288667dbc940e572f2edccb4b35616 Mon Sep 17 00:00:00 2001 From: schodet Date: Sun, 12 Jun 2005 17:34:23 +0000 Subject: Ajout des fichiers lampion. --- d/sys/lampion/local/bin/extractdoc | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 d/sys/lampion/local/bin/extractdoc (limited to 'd/sys/lampion/local/bin') diff --git a/d/sys/lampion/local/bin/extractdoc b/d/sys/lampion/local/bin/extractdoc new file mode 100755 index 0000000..01c0198 --- /dev/null +++ b/d/sys/lampion/local/bin/extractdoc @@ -0,0 +1,55 @@ +#!/usr/bin/perl -w +use strict; + +while (<>) +{ + if (/^\/\*\*/) + { + my @doc; + my @def; + my $stop; + # Capture comments. + INNER: { + do { + chomp; + last INNER if /^[ \t]*\*\/[ \t]*$/; + $stop = 1 if /\*\//; + s/^\/?[ \t]*\*+ ?//; + s/^[ \t]+/\t/; + s/^\t- *([^:-]+) *:/\t[$1]/; + s/[ \t]*\*\///; + push @doc, $_; + last INNER if defined $stop; + } while (<>); + } + # Capture definition. + $_ = <>; + if (/^# *define /) + { + INNER: { + do { + chomp; + push @def, $_ . ' '; + if ($#def > 5) + { + push @def, '...'; + last; + } + last unless /\\$/ + } while (<>); + } + } + else + { + INNER: { + do { + chomp; + s/\)[^)]*$/);/; + push @def, $_; + last if /\)/; + } while (<>); + } + } + print join "\n", @doc, '', '^<<', @def, '^>>', '', ''; + } +} -- cgit v1.2.3