[363] | 1 | #! /usr/bin/perl
|
---|
| 2 | #
|
---|
| 3 | # TOPPERS/JSP Kernel
|
---|
| 4 | # Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 5 | # Just Standard Profile Kernel
|
---|
| 6 | #
|
---|
| 7 | # Copyright (C) 2003 by Embedded and Real-Time Systems Laboratory
|
---|
| 8 | # Toyohashi Univ. of Technology, JAPAN
|
---|
| 9 | # Copyright (C) 2004 by Embedded and Real-Time Systems Laboratory
|
---|
| 10 | # Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 11 | #
|
---|
| 12 | # ä¸è¨èä½æ¨©è
|
---|
| 13 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 14 | # ã«ãã£ã¦å
|
---|
| 15 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 16 | # è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 17 | # ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 18 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 19 | # å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 20 | # (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 21 | # 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 22 | # ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 23 | # (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 24 | # ç¨ã§ããå½¢ã§åé
|
---|
| 25 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 26 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 27 | # è
|
---|
| 28 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 29 | # ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 30 | # (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 31 | # ç¨ã§ããªãå½¢ã§åé
|
---|
| 32 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 33 | # ã¨ï¼
|
---|
| 34 | # (a) åé
|
---|
| 35 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 36 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 37 | # ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 38 | # (b) åé
|
---|
| 39 | å¸ã®å½¢æ
|
---|
| 40 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 41 | # å ±åãããã¨ï¼
|
---|
| 42 | # (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 43 | # 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 44 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 45 | 責ãããã¨ï¼
|
---|
| 46 | #
|
---|
| 47 | # æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 48 | ã
|
---|
| 49 | # ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 50 | # å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 51 | # æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 52 | #
|
---|
| 53 | # @(#) $Id: rename,v 1.3 2005/08/02 01:40:15 hiro Exp $
|
---|
| 54 | #
|
---|
| 55 |
|
---|
| 56 | #
|
---|
| 57 | # ãã¡ã¤ã«ã«ãªãã¼ã ãé©ç¨ãã
|
---|
| 58 | #
|
---|
| 59 | sub rename
|
---|
| 60 | {
|
---|
| 61 | local($infile) = @_;
|
---|
| 62 | local($outfile) = $infile.".new";
|
---|
| 63 | local($line);
|
---|
| 64 |
|
---|
| 65 | open(INFILE, "< ".$infile) || die;
|
---|
| 66 | open(OUTFILE, "> ".$outfile) || die;
|
---|
| 67 |
|
---|
| 68 | while ($line = <INFILE>) {
|
---|
| 69 | $line =~ s/\b(_?)($syms)\b/$1_kernel_$2/gc;
|
---|
| 70 | print OUTFILE $line;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | close(INFILE);
|
---|
| 74 | close(OUTFILE);
|
---|
| 75 |
|
---|
| 76 | if (`diff $infile $outfile`) {
|
---|
| 77 | rename($infile, $infile.".bak");
|
---|
| 78 | rename($outfile, $infile);
|
---|
| 79 | print STDERR "Modified: ",$infile,"\n";
|
---|
| 80 | }
|
---|
| 81 | else {
|
---|
| 82 | unlink($outfile);
|
---|
| 83 | }
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | #
|
---|
| 87 | # ã¨ã©ã¼ãã§ãã¯
|
---|
| 88 | #
|
---|
| 89 | if ($#ARGV < 1) {
|
---|
| 90 | die "Usage: rename <prefix> <filelist>\n";
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | #
|
---|
| 94 | # åæå
|
---|
| 95 | #
|
---|
| 96 | @syms = ();
|
---|
| 97 | $name = $ARGV[0];
|
---|
| 98 |
|
---|
| 99 | #
|
---|
| 100 | # ã·ã³ãã«ãªã¹ããèªã¿è¾¼ã
|
---|
| 101 | #
|
---|
| 102 | $deffile = $name."_rename.def";
|
---|
| 103 | open(INFILE, $deffile) || die "Cannot open $deffile";
|
---|
| 104 | while ($line = <INFILE>) {
|
---|
| 105 | chomp $line;
|
---|
| 106 | if ($line ne "" && $line !~ /^#/) {
|
---|
| 107 | @syms = (@syms, $line)
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | }
|
---|
| 111 | close(INFILE);
|
---|
| 112 |
|
---|
| 113 | $syms = join("|", @syms);
|
---|
| 114 | print STDERR $all_syms;
|
---|
| 115 |
|
---|
| 116 | #
|
---|
| 117 | # ãã¡ã¤ã«ã«ãªãã¼ã ãé©ç¨ãã
|
---|
| 118 | #
|
---|
| 119 | shift @ARGV;
|
---|
| 120 | foreach $infile (@ARGV) {
|
---|
| 121 | # ãã¡ã¤ã«ã§ãªããã°ã¹ããã
|
---|
| 122 | next unless (-f $infile);
|
---|
| 123 |
|
---|
| 124 | do rename($infile) if ($infile ne $deffile);
|
---|
| 125 | }
|
---|