#!/usr/local/bin/perl # # $Header: /e/u/j/local-repository/htdocs/www/software/emacs-20/prom-mew/mew-func-var-const,v 1.1.1.1 2008/03/12 10:53:31 makoto Exp $ $rcsid = q$Id: mew-func-var-const,v 1.1.1.1 2008/03/12 10:53:31 makoto Exp $; $rcsid =~ s/Id://; #------------ my_name for appropriate help message ---- # my name, strip all before '/' inclusively # /home/fujiwara/perl/my_name -> my_name $my_name = $0; $my_name =~ s#(.*)/##; #------------ my_path for getting right @INC path ----- # my location, strip rightmost '/' and right of it. # /home/fujiwara/perl/my_path -> /home/fujiwara/perl $my_path = $0; $my_path =~ s|/[^/]+$||; #--------------------- push(@INC,"$my_path"); require 'getopts.pl'; &Getopts('dhf'); # ----------------- help ------------- if ( $opt_h ) { &usage ; } # ----------------------------------- $dir = $ARGV[0]; $new = $ARGV[1]; print $dir, "\n"; if ( -d $dir ) { chdir $dir } else { die "$dir should be existing directory.\n"}; foreach $EL ( sort <*.el> ) { ## print $EL,"\n"; open (EL) || print "problem opening el file($EL)\n"; while() { if ( /^\s*;/ ) { next } if ( /defconst (\S+)\s+/ || /defvar (\S+)\s+/ || /defun (\S+)\s+/ ) { $symbol = $1 ; ## printf "%-20s: %s\n", $EL, $symbol; $WHODEFINES{$symbol} .= $EL.' '; }} close($EL);} # 標準入力から読んで、その中にどのような mew- という文字列がある # かだけを @mew-文字列名に入れておく while () { $count++; if ( /mew-/ ) { s/\(/ /g; s/\)/ /g; s/\,/ /g; @primitives = split; foreach (@primitives) { if ( /^(mew-\S+)/ ) { $symbol = $1 ; $list{$symbol}++; eval " push(\@$symbol,$count)\n"; }}}} # 定義している *.el を表示する。 foreach $sym (sort keys %list ) { $ELrelated{$WHODEFINES{$sym}}++; # sym を定義している関数に何があるかの一覧を作っておく if ( $opt_f ) { printf("%-40s -> %s\n", $sym,$WHODEFINES{$sym});} $func = $WHODEFINES{$sym}; $func =~ s/ //g; $INCLUDES{$func} .= $sym. ' '; # 関数名 } # lstat して時刻情報を調べる ### print scalar(localtime(time())),"\n"; if ( -d $dir & -d $new ) { foreach $el ( sort keys %ELrelated ) { $el =~ s/ //g; $file_dir = $ $file_new = $new . '/'. $el ; $mtime_dir = (lstat($dir . '/'. $el ))[9]; $m_dir = localtime($mtime_dir); $mtime_new = (lstat($new . '/'. $el ))[9]; $m_new = localtime($mtime_new); if ( $mtime_dir == $mtime_new ) { next } printf("%-20s %s -> %s\n", $el,$m_dir,$m_new); print " ", $INCLUDES{$el},"\n"; }} # ---------------- sub usage { print < *.el file table Note: version: $rcsid HELPHELP exit; } __END__ # $Log: mew-func-var-const,v $ # Revision 1.1.1.1 2008/03/12 10:53:31 makoto # initial # # Revision 1.2 1999/12/13 02:51:08 makoto # now showing the name of primitive for each *.el file # # Revision 1.1 1999/12/13 02:37:56 makoto # Initial revision # makoto@fujiwara■10:46:43/991213(~)> perl/practice/mew-func-var-const $SITELISP/{.mew-1.95b3,mew-1.95b9} < $SITELISP/a-first-files/prom-mew.el