1 /* Mapping table for CP737.
2 Copyright (C) 1998-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
21 /* Table to map to UCS4. It can be generated using
22 (I know, this is a useless use of cat, but the linebreak requires it):
24 cat .../unix/mappings/vendors/micsft/pc/cp737.txt |
25 sed -e 's/\(0x..\)[[:space:]]*\(0x....\).*$/ [\1] = \2,/p' -e d
28 static const uint32_t to_ucs4
[256] =
289 /* Index table for mapping from UCS4. The table can be generated with
291 cat .../unix/mappings/vendors/micsft/pc/cp737.txt |
292 awk '/^0x/ { if (NF > 2) print $2; }' | perl gap.pl
294 where gap.pl is the file in this directory.
296 static const struct gap from_idx
[] =
298 { .start
= 0x0000, .end
= 0x007f, .idx
= 0 },
299 { .start
= 0x00a0, .end
= 0x00a0, .idx
= -32 },
300 { .start
= 0x00b0, .end
= 0x00b7, .idx
= -47 },
301 { .start
= 0x00f7, .end
= 0x00f7, .idx
= -110 },
302 { .start
= 0x0386, .end
= 0x03ce, .idx
= -764 },
303 { .start
= 0x207f, .end
= 0x207f, .idx
= -8108 },
304 { .start
= 0x2219, .end
= 0x221a, .idx
= -8517 },
305 { .start
= 0x2248, .end
= 0x2248, .idx
= -8562 },
306 { .start
= 0x2264, .end
= 0x2265, .idx
= -8589 },
307 { .start
= 0x2500, .end
= 0x2502, .idx
= -9255 },
308 { .start
= 0x250c, .end
= 0x251c, .idx
= -9264 },
309 { .start
= 0x2524, .end
= 0x2524, .idx
= -9271 },
310 { .start
= 0x252c, .end
= 0x252c, .idx
= -9278 },
311 { .start
= 0x2534, .end
= 0x2534, .idx
= -9285 },
312 { .start
= 0x253c, .end
= 0x253c, .idx
= -9292 },
313 { .start
= 0x2550, .end
= 0x256c, .idx
= -9311 },
314 { .start
= 0x2580, .end
= 0x2593, .idx
= -9330 },
315 { .start
= 0x25a0, .end
= 0x25a0, .idx
= -9342 },
316 { .start
= 0xffff, .end
= 0xffff, .idx
= 0 }
319 /* Table accessed through above index table. It can be generated using:
321 cat .../unix/mappings/vendors/micsft/pc/cp737.txt |
322 awk '/^0x/ { if (NF > 2) print $2, $1; }' | perl gaptab.pl
324 where gaptab.pl is the file in this directory.
326 static const char from_ucs4
[] =
328 '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
329 '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
330 '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
331 '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f',
332 '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27',
333 '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f',
334 '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37',
335 '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f',
336 '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47',
337 '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f',
338 '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57',
339 '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f',
340 '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67',
341 '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f',
342 '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77',
343 '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f',
344 '\xff', '\xf8', '\xf1', '\xfd', '\x00', '\x00', '\x00', '\x00',
345 '\xfa', '\xf6', '\xea', '\x00', '\xeb', '\xec', '\xed', '\x00',
346 '\xee', '\x00', '\xef', '\xf0', '\x00', '\x80', '\x81', '\x82',
347 '\x83', '\x84', '\x85', '\x86', '\x87', '\x88', '\x89', '\x8a',
348 '\x8b', '\x8c', '\x8d', '\x8e', '\x8f', '\x90', '\x00', '\x91',
349 '\x92', '\x93', '\x94', '\x95', '\x96', '\x97', '\xf4', '\xf5',
350 '\xe1', '\xe2', '\xe3', '\xe5', '\x00', '\x98', '\x99', '\x9a',
351 '\x9b', '\x9c', '\x9d', '\x9e', '\x9f', '\xa0', '\xa1', '\xa2',
352 '\xa3', '\xa4', '\xa5', '\xa6', '\xa7', '\xa8', '\xaa', '\xa9',
353 '\xab', '\xac', '\xad', '\xae', '\xaf', '\xe0', '\xe4', '\xe8',
354 '\xe6', '\xe7', '\xe9', '\xfc', '\xf9', '\xfb', '\xf7', '\xf3',
355 '\xf2', '\xc4', '\x00', '\xb3', '\xda', '\x00', '\x00', '\x00',
356 '\xbf', '\x00', '\x00', '\x00', '\xc0', '\x00', '\x00', '\x00',
357 '\xd9', '\x00', '\x00', '\x00', '\xc3', '\xb4', '\xc2', '\xc1',
358 '\xc5', '\xcd', '\xba', '\xd5', '\xd6', '\xc9', '\xb8', '\xb7',
359 '\xbb', '\xd4', '\xd3', '\xc8', '\xbe', '\xbd', '\xbc', '\xc6',
360 '\xc7', '\xcc', '\xb5', '\xb6', '\xb9', '\xd1', '\xd2', '\xcb',
361 '\xcf', '\xd0', '\xca', '\xd8', '\xd7', '\xce', '\xdf', '\x00',
362 '\x00', '\x00', '\xdc', '\x00', '\x00', '\x00', '\xdb', '\x00',
363 '\x00', '\x00', '\xdd', '\x00', '\x00', '\x00', '\xde', '\xb0',
364 '\xb1', '\xb2', '\xfe',