#!/usr/bin/perl use MLDBM qw(DB_File); use DB_File; use Data::Dumper; use Storable ; use Fcntl ; use dpl; use POSIX; setlocale("LC_CTYPE","iso_8859_1"); my $file = shift; &dpl::plexinit($file); my $parser=new dpl::grammar; tie %h, MLDBM, "$file.Xdb", O_RDWR|O_CREAT|O_TRUNC, 0644, $DB_BTREE or die $! ; open A,">$file.Xwrdlst" or die "cant open file\n"; #dpl::grammar::setMetaProcessFunction(sub { store(shift,"$file.store") }); dpl::grammar::setMetaProcessFunction( sub { $h{'!meta'}=shift; #print STDERR Dumper($h{'!meta'}); }); dpl::grammar::setDictProcessFunction( sub { for (@{$_[0]}) { $name = $_->{'!name'}; delete $_->{'!name'}; $tmp = [@{$h{$name}}, $_ ] ; $h{$name} = $tmp; } }); $parser -> YYParse(yylex=>\&dpl::yylex, yyerror=>\&dpl::yyerror); for (keys %h) { print A "$_\n"; } close A; untie %h; rename "$file.Xwrdlst", "$file.wrdlst"; rename "$file.Xdb", "$file.db";