#!/usr/bin/perl -- # -*-Perl-*- eval "exec /usr/bin/perl -S $0 $*" if $running_under_some_shell; # Construct a permuted index for all system include files. # Copyright (C) 1991 Free Software Foundation, Inc. # Francois Pinard , June 1991. # NOTE: about removing asm statements? # NOTE: about removing strings? # NOTE: about ignoring 0xHEXDIGITS, unchar/ushort/etc. # Construct a sorted list of system include files. opendir (DIR, "/usr/include"); @includes = sort grep (-f "/usr/include/$_", readdir (DIR)); opendir (DIR, "/usr/include/sys"); foreach (sort grep (-f "/usr/include/sys/$_", readdir (DIR))) { push (@includes, "sys/$_"); } closedir (DIR); # Launch the permuted indexer, with a list of ignore words. $ignore = "/tmp/incptx.$$"; open (IGNORE, "> $ignore"); print IGNORE join ("\n", split (' ', <) { # Get rid of comments. $comment = $next_comment; if ($comment) { $next_comment = !s,^.*\*/,,; } else { s,/\*.*\*/,,g; $next_comment = s,/\*.*,,; } next if $comment && $next_comment; # Remove extraneous white space. s/[ \t]+/ /g; s/ $//; next if /^$/; # Print the line with its reference. print "$include($.): ", $_; } } warn "All read, now ptx' game!\n"; close OUTPUT || die "ptx failed...\n"; unlink $ignore;