File: Unicode.pm

package info (click to toggle)
libjcode-pm-perl 2.07-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,440 kB
  • sloc: perl: 14,814; ansic: 11,032; makefile: 3
file content (146 lines) | stat: -rw-r--r-- 3,087 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#
# $Id: Unicode.pm,v 2.0 2005/05/16 19:08:12 dankogai Exp $
#

package Jcode::Unicode;

use strict;
use vars qw($RCSID $VERSION @ISA @EXPORT $PEDANTIC);

$RCSID = q$Id: Unicode.pm,v 2.0 2005/05/16 19:08:12 dankogai Exp $;
$VERSION = do { my @r = (q$Revision: 2.0 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };

use Carp;
require Exporter;
require DynaLoader;

@ISA = qw(Exporter DynaLoader);

$PEDANTIC ||= 0;

bootstrap Jcode::Unicode $VERSION;

# Merge these subs to Jcode

sub Jcode::_Classic::ucs2_euc{
    my ($thingy) = @_;
    my $r_str = ref $thingy ? $thingy : \$thingy;
    return
        $$r_str = Jcode::Unicode::ucs2_euc($$r_str);
}

sub Jcode::_Classic::euc_ucs2{
    my ($thingy) = @_;
    my $r_str = ref $thingy ? $thingy : \$thingy;
    return
        $$r_str = Jcode::Unicode::euc_ucs2($$r_str);
}

sub Jcode::_Classic::ucs2_utf8{
    my ($thingy) = @_;
    my $r_str = ref $thingy ? $thingy : \$thingy;
    return
        $$r_str = Jcode::Unicode::ucs2_utf8($$r_str);
}

sub Jcode::_Classic::utf8_ucs2{
    my ($thingy) = @_;
        my $r_str = ref $thingy ? $thingy : \$thingy;
    return
        $$r_str = Jcode::Unicode::utf8_ucs2($$r_str);
}

sub Jcode::_Classic::euc_utf8{
    my ($thingy) = @_;
    my $r_str = ref $thingy ? $thingy : \$thingy;
    return
        $$r_str = Jcode::Unicode::euc_utf8($$r_str);
}

sub Jcode::_Classic::utf8_euc{
    my ($thingy) = @_;
        my $r_str = ref $thingy ? $thingy : \$thingy;
    return
        $$r_str = Jcode::Unicode::utf8_euc($$r_str);
}

1;
__END__

=head1 NAME

Jcode::Unicode - Aux. routines for Jcode

=head1 SYNOPSIS

NONE

=head1 DESCRIPTION

This module implements following subs as XS.  Used via Jcode.pm.

This module is called by Jcode.pm on demand.  This module is not intended for
direct use by users.  This modules implements functions related to Unicode.  
Following functions are defined here;

=over 4

=item Jcode::ucs2_euc();

=item Jcode::euc_ucs2();

=item Jcode::ucs2_utf8();

=item Jcode::utf8_ucs2();

=item Jcode::euc_utf8();

=item Jcode::utf8_euc();

=back

=cut

=head1 VARIABLES

=over 4

=item B<$Jcode::Unicode::PEDANTIC>

Now obsolete and abolished.  It used to mean..

When set to non-zero, x-to-unicode conversion becomes pedantic.  
That is, '\' (chr(0x5c)) is converted to zenkaku backslash and 
'~" (chr(0x7e)) to JIS-x0212 tilde.

By Default, Jcode::Unicode leaves ascii ([0x00-0x7f]) as it is.

But as of perl 5.8.  It has been standarlized (in perl community)
that we leave ascii as it is so Jcode no longer has to support
this option.

=back

=cut

=head1 BUGS

If any, that is Unicode, Inc. to Blame (Especially JIS0201.TXT).

=head1 SEE ALSO

L<http://www.unicode.org/>
L<http://www.debian.or.jp/~kubota/unicode-symbols.html.en>

=head1 COPYRIGHT

Copyright 1999-2003 Dan Kogai <dankogai@dan.co.jp>

This library is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.

Unicode conversion table used here are based uponon files at
ftp://ftp.unicode.org/Public/MAPPINGS/EASTASIA/JIS/,
Copyright (c) 1991-1994 Unicode, Inc.

=cut