#!/usr/bin/env perl #-*- perl -*- # # Copyright (C) 2001 Ken'ichi Fukamachi # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # # $FML: varlist.pl,v 1.2 2002/04/01 23:41:24 fukachan Exp $ # use strict; use Carp; use Getopt::Long; use lib qw(../../../../fml/lib ../../../../cpan/lib); my %option = (); my %list = ('__table_head__' => { varname => 'variable name', desc => 'descrition', value => 'default value(s)', }); my $desc = ''; my $varname = ''; my $value = ''; GetOptions(\%option, qw(debug! d! sgml! html!)); &read_config_cf; &print_varlist; exit 0; sub read_config_cf { while (<>) { # reset if we encounters blank line if (/^\s*$/) { _alloc_entry($varname, $desc, $value); undef $desc; undef $varname; undef $value; } if (/^\#\s*Descriptions:(.*)/) { $desc = $1; } if (/^([\w\d+_]+)\s*=\s*(.*)/) { $varname = $1; $value = $2 . "\n"; $value =~ s/^\s*//; } if ($varname && /^\s+(.*)/) { $value .= $1 . "\n"; } } } sub _alloc_entry { my ($varname, $desc, $value) = @_; if ($varname && $desc && $value) { $value =~ s/\n/\n /g; $list{ $varname }->{ varname } = $varname; $list{ $varname }->{ desc } = $desc; $list{ $varname }->{ value } = $value; } } my ($table_begin, $table_end) = (); my $table_title = ''; my ($table_entry_begin, $table_entry_end) = (); my ($table_thead_begin, $table_thead_end) = (); my ($table_tbody_begin, $table_tbody_end) = (); my ($table_block_begin, $table_block_end) = (); sub _customize_tag { if (defined $option{ html }) { $table_begin = "