comedilib/doc/mkdr
2008-02-11 15:50:36 +00:00

165 lines
2.5 KiB
Perl
Executable file

#!/usr/bin/perl
# vim: set ts=4:
$manvolnum="3";
$header="#include <comedilib.h>";
$end = "";
print
'<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY % comedilib_entities SYSTEM "comedilib.ent">
%comedilib_entities;
]>
<!--This file is autogenerated. Do not edit-->
<section id="lowleveldrivers">
<title>
Kernel drivers
</title>
';
while(<>){
push @lines,$_;
}
$secend="";
$status="unknown";
while($s = shift @lines){
@x = $s;
if($s =~ m/^\w+\:/){
$blank=0;
chomp $s;
$x = $s;
LOOP: while($s = shift @lines){
if($s =~ m/^\w+:/ or $s eq "\n"){
unshift @lines, $s;
last LOOP;
}
chomp $s;
$x = "$x $s";
}
if($x =~ m/^Driver: (.*)/){
$driver = $1;
}elsif($x =~ m/^Description: (.*)/){
$description = $1;
}elsif($x =~ m/^Devices: (.*)/){
$devices = $1;
}elsif($x =~ m/^Author: (.*)/){
$author = $1
}elsif($x =~ m/^Status: (.*)/){
$status = $1
}
}else{
if($s eq "\n"){
$blank ++;
}else{
$blank = 0;
}
$comment = $comment . $s;
}
if($blank==3){
$comment =~ s/&/&amp;/g;
$comment =~ s/@/&#64;/g;
$comment =~ s/</&lt;/g;
$comment =~ s/>/&gt;/g;
$author =~ s/&/&amp;/g;
$author =~ s/@/&#64;/g;
$author =~ s/</&lt;/g;
$author =~ s/>/&gt;/g;
$description =~ s/&/&amp;/g;
print
"
<section>
<title>
$driver -- $description
</title>
<para>
Author: $author
</para>
<para>
Status: $status
</para>
";
if($devices ne ""){
print
" <informaltable>
<tgroup cols='3' align='left'>
<thead>
<row>
<entry>Manufacturer</entry>
<entry>Device</entry>
<entry>Name</entry>
</row>
</thead>
<tbody>
";
while($devices){
$_=$devices;
if(m/^ *\[([^\]]+)\](.*)/){
$mfr = $1;
$devices = $2;
}elsif(m/^ *\(([^\)]+)\)(.*)/){
$name = $1;
$devices = $2;
}elsif(m/^ *([^\(,]+)(.*)/){
$dev = $1;
$devices = $2;
$dev =~ s/ *$//;
}elsif(m/^ *,(.*)/){
$devices = $1;
print
" <row>
<entry>
$mfr
</entry>
<entry>
$dev
</entry>
<entry>
$name
</entry>
</row>
";
}else{
die "parse error";
}
}
print
" <row>
<entry>
$mfr
</entry>
<entry>
$dev
</entry>
<entry>
$name
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
";
}
print
"
<screen>
$comment
</screen>
</section>";
$blank=0;
$comment="";
$status="unknown";
}
}
print
"</section>
";
exit(0);