Skip to content

Commit ff95edb

Browse files
Add macCentEuro encoding
1 parent 5233c68 commit ff95edb

File tree

6 files changed

+40
-0
lines changed

6 files changed

+40
-0
lines changed

bin/encodings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ when "iso-8859-14" then table(Encoding::ISO8859_14)
8080
when "iso-8859-15" then table(Encoding::ISO8859_15)
8181
when "iso-8859-16" then table(Encoding::ISO8859_16)
8282
when "koi8-r" then table(Encoding::KOI8_R)
83+
when "maccenteuro" then table(Encoding::MACCENTEURO)
8384
when "macgreek" then table(Encoding::MACGREEK)
8485
when "maciceland" then table(Encoding::MACICELAND)
8586
when "macroman" then table(Encoding::MACROMAN)

docs/encoding.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The key of the comment can be either "encoding" or "coding". The value of the co
4646
* `ISO-8859-15`
4747
* `ISO-8859-16`
4848
* `KOI8-R`
49+
* `macCentEuro`
4950
* `macGreek`
5051
* `macIceland`
5152
* `macRoman`

include/prism/enc/pm_encoding.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ extern pm_encoding_t pm_encoding_iso_8859_14;
190190
extern pm_encoding_t pm_encoding_iso_8859_15;
191191
extern pm_encoding_t pm_encoding_iso_8859_16;
192192
extern pm_encoding_t pm_encoding_koi8_r;
193+
extern pm_encoding_t pm_encoding_mac_cent_euro;
193194
extern pm_encoding_t pm_encoding_mac_greek;
194195
extern pm_encoding_t pm_encoding_mac_iceland;
195196
extern pm_encoding_t pm_encoding_mac_roman;

src/enc/pm_tables.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,30 @@ static uint8_t pm_encoding_koi8_r_table[256] = {
720720
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // Fx
721721
};
722722

723+
/**
724+
* Each element of the following table contains a bitfield that indicates a
725+
* piece of information about the corresponding macCentEuro character.
726+
*/
727+
static uint8_t pm_encoding_mac_cent_euro_table[256] = {
728+
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
729+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
730+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
731+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2x
732+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, // 3x
733+
0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // 4x
734+
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, // 5x
735+
0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 6x
736+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, // 7x
737+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8x
738+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9x
739+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ax
740+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Bx
741+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Cx
742+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Dx
743+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Ex
744+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // Fx
745+
};
746+
723747
/**
724748
* Each element of the following table contains a bitfield that indicates a
725749
* piece of information about the corresponding macGreek character.
@@ -1222,6 +1246,7 @@ PRISM_ENCODING_TABLE(iso_8859_14)
12221246
PRISM_ENCODING_TABLE(iso_8859_15)
12231247
PRISM_ENCODING_TABLE(iso_8859_16)
12241248
PRISM_ENCODING_TABLE(koi8_r)
1249+
PRISM_ENCODING_TABLE(mac_cent_euro)
12251250
PRISM_ENCODING_TABLE(mac_greek)
12261251
PRISM_ENCODING_TABLE(mac_iceland)
12271252
PRISM_ENCODING_TABLE(mac_roman)
@@ -1552,6 +1577,16 @@ pm_encoding_t pm_encoding_koi8_r = {
15521577
.multibyte = false
15531578
};
15541579

1580+
/** macCentEuro */
1581+
pm_encoding_t pm_encoding_mac_cent_euro = {
1582+
.name = "macCentEuro",
1583+
.char_width = pm_encoding_single_char_width,
1584+
.alnum_char = pm_encoding_mac_cent_euro_alnum_char,
1585+
.alpha_char = pm_encoding_mac_cent_euro_alpha_char,
1586+
.isupper_char = pm_encoding_mac_cent_euro_isupper_char,
1587+
.multibyte = false
1588+
};
1589+
15551590
/** macGreek */
15561591
pm_encoding_t pm_encoding_mac_greek = {
15571592
.name = "macGreek",

src/prism.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6136,6 +6136,7 @@ parser_lex_magic_comment_encoding_value(pm_parser_t *parser, const uint8_t *star
61366136
ENCODING1("locale", pm_encoding_utf_8);
61376137
break;
61386138
case 'M': case 'm':
6139+
ENCODING1("macCentEuro", pm_encoding_mac_cent_euro);
61396140
ENCODING1("macGreek", pm_encoding_mac_greek);
61406141
ENCODING1("macIceland", pm_encoding_mac_iceland);
61416142
ENCODING1("macRoman", pm_encoding_mac_roman);

test/prism/encoding_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class EncodingTest < TestCase
3838
Encoding::ISO_8859_15 => 0x00...0x100,
3939
Encoding::ISO_8859_16 => 0x00...0x100,
4040
Encoding::KOI8_R => 0x00...0x100,
41+
Encoding::MACCENTEURO => 0x00...0x100,
4142
Encoding::MACGREEK => 0x00...0x100,
4243
Encoding::MACICELAND => 0x00...0x100,
4344
Encoding::MACROMAN => 0x00...0x100,

0 commit comments

Comments
 (0)