#!/usr/bin/perl # $Id: ident,v 1.6 1998/04/30 11:58:16 argggh Exp $ # ident -- Look up identifiers # # Arne Georg Gleditsch # Per Kristian Gjermshus # # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ###################################################################### use lib 'lib/'; use LXR::Common; use LXR::Config; use DB_File; %ty = (('M', '预处理宏'), ('V', '变量'), ('f', '函数原型'), ('F', '函数'), ('C', '类'), # C++ ('c', '(前向) 类'), # C++ ('T', '类型'), ('S', 'struct类型'), ('E', 'enum类型'), ('U', 'union类型')); sub ident { print("
\n"); foreach ($Conf->allvariables) { if ($Conf->variable($_) ne $Conf->vardefault($_)) { print("variable($_), "\">\n"); } } print("标识符: \n", "\n", "
\n"); if ($identifier) { tie(%xref, "DB_File", $Conf->dbdir."/xref", O_RDONLY, undef, $DB_HASH) || &fatal("Could not open \"".$Conf->dbdir."/xref\""); @refs = split(/\t/,$xref{$identifier}); print("

$identifier

\n"); if (@refs) { tie(%fileidx, "DB_File", $Conf->dbdir."/fileidx", O_RDONLY, undef, $DB_HASH) || &fatal("Could not open \"".$Conf->dbdir."/fileidx\""); foreach (@refs) { $f{$1} .= "$2\t" if /^(.)(.*)/; } foreach $t (keys(%ty)) { if ($f{$t}) { print("在下面定义为$ty{$t}:\n"); } } print("在下面(共 ",int(grep(/^R/, @refs))," 文件中)被引用:\n", "\n"); untie(%fileidx); } else { print("
Not used"); } untie(%xref); } } ($Conf, $HTTP, $Path) = &init; $identifier = $HTTP->{'param'}->{'i'}; &makeheader('ident'); &ident; &makefooter('ident');