author  skalberg 
Thu, 28 Aug 2003 01:56:40 +0200  
changeset 14171  0cab06e3bbd0 
child 14981  e73f8140af78 
permissions  rwrr 
14171
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

1 
# 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

2 
# $Id$ 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

3 
# Author: Sebastian Skalberg, TU Muenchen 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

4 
# License: GPL (GNU GENERAL PUBLIC LICENSE) 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

5 
# 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

6 
# fixgreek.pl  fix problems with greek and other foreign letters now 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

7 
# being classified as letters instead of symbols. 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

8 
# 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

9 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

10 
sub fixgreek { 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

11 
my ($file) = @_; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

12 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

13 
open (FILE, $file)  die $!; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

14 
undef $/; $text = <FILE>; $/ = "\n"; # slurp whole file 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

15 
close FILE  die $!; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

16 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

17 
$_ = $text; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

18 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

19 
s/(\\<(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)>)([azAZ09])/$1 $3/sg; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

20 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

21 
s/([azAZ][azAZ09]*)(\\<(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)>)/$1 $2/sg; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

22 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

23 
s/(\\<(aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzAABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ)>)([azAZ09])/$1 $3/sg; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

24 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

25 
s/([azAZ][azAZ09]*)(\\<(aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzzAABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ)>)/$1 $2/sg; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

26 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

27 
s/(\\<(alphabetagammadeltaepsilonzetaetathetaiotakappamunuxipirhosigmatauupsilonphipsiomegaGammaDeltaThetaLambdaXiPiSigmaUpsilonPhiPsiOmega)>)([azAZ09])/$1 $3/sg; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

28 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

29 
s/([azAZ][azAZ09]*)(\\<(alphabetagammadeltaepsilonzetaetathetaiotakappamunuxipirhosigmatauupsilonphipsiomegaGammaDeltaThetaLambdaXiPiSigmaUpsilonPhiPsiOmega)>)/$1 $2/sg; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

30 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

31 
$result = $_; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

32 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

33 
if ($text ne $result) { 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

34 
print STDERR "fixing $file\n"; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

35 
if (! f "$file~~") { 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

36 
rename $file, "$file~~"  die $!; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

37 
} 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

38 
open (FILE, "> $file")  die $!; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

39 
print FILE $result; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

40 
close FILE  die $!; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

41 
} 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

42 
} 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

43 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

44 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

45 
## main 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

46 

0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

47 
foreach $file (@ARGV) { 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

48 
eval { &fixgreek($file); }; 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

49 
if ($@) { print STDERR "*** fixgreek $file: ", $@, "\n"; } 
0cab06e3bbd0
Extended the notion of letter and digit, such that now one may use greek,
skalberg
parents:
diff
changeset

50 
} 