NAME¶
Charset::Hollerith - allows to use Hollerith string constants in ASCII programs
(and v.v.)
SYNOPSIS¶
use Charset::Hollerith qw(hollerith2ascii);
my $a = hollerith2ascii "(Hollerith text)";
DESCRIPTION¶
Charset::Hollerith defines functions to convert between a subset of ASCII
and a subset of nonstandard Hollerith (since there isn't such a thing as a
standard Hollerith we defined our own variant which is guaranteed to be
incompatible with all versions of Hollerith used by IBM hardware - however,
for each character code we have used the code used by some (but not all) IBM
card reader, if the code exists in Hollerith at all, or we have made one up in
some logical way (such as overpunching) if no IBM hardware had that particular
character.
The two functions
hollerith2ascii and
ascii2hollerith are
exportable but not exported by default. They do the obvious thing to their
argument.
HOLLERITH CHARACTER TABLE¶
A Hollerith string is a sequence of 12-bit characters; they are encoded as two
ASCII characters, containing 6 bits each: the first character contains punches
12, 0, 2, 4, 6, 8 and the second character contains punches 11, 1, 3, 5, 7, 9;
interleaving the two characters gives the original 12 bits. To make the
characters printable on ASCII terminals, bit 7 is always set to 0, and bit 6
is set to the complement of bit 5. These two bits are ignored when reading
Hollerith cards.
Some Hollerith characters (produced by overpunching) can be converted to
sequences of ASCII characters;
ascii2hollerith will correctly recognise
the sequences.
The following punched cards document the encoding of characters (the last three
symbols at the end nongraphic symbols in ASCII; the previous two symbols
correspond to multicharacter sequences):
' !"#$%&()*+,-./:;<=>?@[\]^_`{|}~XX0123456789
12 * * * * * * * * * * 12
11 * * * * ** ** * * * 11
0 * * * * **** * * *** 0
1 * * * 1
2 * * * * * 2
3 ** * * * * 3
4 *** * * ** * * * * 4
5 * * * * * * 5
6 * * ** * * 6
7 * *** * * 7
8 * ******** * * ******* * * * * * 8
9 * * * 9
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrs
12 ********* ********* 12
11 ********* ********* 11
0 ********* * * 0
1 * * ** ** * 1
2 * * * ** ** * 2
3 * * * ** ** 3
4 * * * ** ** 4
5 * * * ** ** 5
6 * * * ** ** 6
7 * * * ** ** 7
8 * * * ** ** 8
9 * * * * * 9
tuvwxyz [] ". NL CR HT
12 * * * 12
11 * 11
0 ******* * * 0
1 * * * 1
2 * * * * 2
3 ** * * * * 3
4 ** * * * * 4
5 ** * * * 5
6 ** * * * 6
7 ** * * * * * 7
8 ** * * * * 8
9 * * * * 9
PLEASE NOTE that versions of CLC-INTERCAL before 1.-94.-2 had a bug which caused
a rabbit to be represented as 12-3-2-8 instead of 12-3-7-8. Cards punched with
such older versions, and containing rabbits, will need to be copied with one
of the rabbit holes moved from row 2 to row 7.
COPYRIGHT¶
This module is part of CLC-INTERCAL.
Copyright (C) 2000, 2002, 2006, 2007 Claudio Calvelli, all rights reserved
See the files README and COPYING in the distribution for information.
SEE ALSO¶
A qualified psychiatrist.
POD ERRORS¶
Hey!
The above document had some coding errors, which are explained
below:
- Around line 253:
- Non-ASCII character seen before =encoding in
'!"#$%&()*+,-./:;<=>?@[\]^_`{|}~XX0123456789'. Assuming
ISO8859-1