~ubuntu-branches/ubuntu/gutsy/lv/gutsy

« back to all changes in this revision

Viewing changes to src/mapksc.pl

  • Committer: Bazaar Package Importer
  • Author(s): GOTO Masanori
  • Date: 2003-11-16 01:21:59 UTC
  • Revision ID: james.westby@ubuntu.com-20031116012159-wpu27qhoxzskmjy0
Tags: upstream-4.50
ImportĀ upstreamĀ versionĀ 4.50

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/local/bin/perl
 
2
 
 
3
# All rights reserved. Copyright (C) 1999 by NARITA Tomio.
 
4
#
 
5
# This program is free software; you can redistribute it and/or modify
 
6
# it under the terms of the GNU General Public License as published by
 
7
# the Free Software Foundation; either version 2 of the License, or
 
8
# (at your option) any later version.
 
9
 
 
10
# Unicode to KSC 5601-1987
 
11
 
 
12
$file = "zcat KSX1001.TXT.gz |";
 
13
 
 
14
for $i ( 0 .. $#ARGV ){
 
15
  if( $ARGV[ $i ] eq "-i" ){
 
16
    $file = $ARGV[ ++$i ];
 
17
  }
 
18
}
 
19
 
 
20
open( FILE, $file ) || die( "cannot open $file" );
 
21
 
 
22
while( <FILE> ){
 
23
  chop;
 
24
  if( /^#/ ){
 
25
     next;
 
26
   }
 
27
  ( $ksc, $uni, $rest ) = split;
 
28
  $count++;
 
29
  $array{ $uni } = $ksc;
 
30
}
 
31
 
 
32
print "private codes_t mapKSC5601[ $count ] = {\n";
 
33
 
 
34
for $index ( sort keys( %array ) ){
 
35
  $code = $array{ $index };
 
36
  $count--;
 
37
  if( $count == 0 ){
 
38
    print "  { $index, $code }\n";
 
39
  } else {
 
40
    print "  { $index, $code },\n";
 
41
  }
 
42
}
 
43
 
 
44
print "};\n";