#!/bin/sh
: ${fvwm_libdir=../../libs}
infile=${fvwm_libdir}/Module.h
outfile=`dirname $0`/Constants.pm
( \
echo "# Autogenerated from the fvwm sources."; \
echo ""; \
echo "package FVWM::Constants;"; \
echo "use Exporter;"; \
echo "use Config;"; \
echo "@ISA = qw(Exporter);"; \
echo ""; \
) \
>$outfile
( \
grep "#define M_" $infile; \
grep "#define MX_" $infile | sed 's/ | /|/'; \
grep "#define MAX_MSG_MASK " $infile; \
grep "#define MAX_XMSG_MASK " $infile; \
grep "#define FvwmPacketHeaderSize " $infile | sed 's/FvwmPacketHeaderSize/HEADER_SIZE/'; \
grep "#define START_FLAG " $infile; \
grep "#define ModuleFinishedStartupResponse " $infile | tr ' ' : | sed 's/:ModuleFinishedStartupResponse:\+/ RESPONSE_READY /'; \
grep "#define ModuleUnlockResponse " $infile | tr ' ' : | sed 's/:ModuleUnlockResponse:\+/ RESPONSE_UNLOCK /'; \
) \
| awk '{ print "use constant " $2 " => " $3 ";" }' \
| tr : ' ' \
>>$outfile
( \
echo "use constant ON_EXIT => '1e20';"; \
echo "use constant INTSIZE => \$Config{longsize};" \
) \
>>$outfile
( \
grep constant $outfile | cut -d" " -f3 | awk '{ print " " $1 }'; \
) \
>"$outfile.tmp"
( \
echo '@EXPORT = qw('; \
cat "$outfile.tmp"; \
echo ');' \
) \
>>$outfile
( \
echo "
1;
__END__
=head1 NAME
FVWM::Constants - exports fvwm specific constants
=head1 DESCRIPTION
This class is used to load fvwm constants into your perl script or class.
Note, if you use I<FVWM::Module> the constants are automatically exported.
So you usually do not need to include this class.
=head1 USAGE
use FVWM::Constants;
=head1 SEE ALSO
For more information, see L<FVWM::Module>.
=head1 EXPORTED CONSTANTS
"; \
cat "$outfile.tmp"; \
) \
>>$outfile
rm "$outfile.tmp"
syntax highlighted by Code2HTML, v. 0.9.1