Deleted Added
full compact
charset.c (172598) charset.c (191930)
1/*
1/*
2 * Copyright (C) 1984-2007 Mark Nudelman
2 * Copyright (C) 1984-2008 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

--- 377 unchanged lines hidden (view full) ---

388 setbinfmt(s, &utfbinfmt, "<U+%04lX>");
389}
390
391/*
392 * Is a given character a "binary" character?
393 */
394 public int
395binary_char(c)
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information about less, or for information on how to
8 * contact the author, see the README file.
9 */
10

--- 377 unchanged lines hidden (view full) ---

388 setbinfmt(s, &utfbinfmt, "<U+%04lX>");
389}
390
391/*
392 * Is a given character a "binary" character?
393 */
394 public int
395binary_char(c)
396 unsigned char c;
396 LWCHAR c;
397{
397{
398 if (utf_mode)
399 return (is_ubin_char(c));
398 c &= 0377;
399 return (chardef[c] & IS_BINARY_CHAR);
400}
401
402/*
403 * Is a given character a "control" character?
404 */
405 public int
406control_char(c)
400 c &= 0377;
401 return (chardef[c] & IS_BINARY_CHAR);
402}
403
404/*
405 * Is a given character a "control" character?
406 */
407 public int
408control_char(c)
407 int c;
409 LWCHAR c;
408{
409 c &= 0377;
410 return (chardef[c] & IS_CONTROL_CHAR);
411}
412
413/*
414 * Return the printable form of a character.
415 * For example, in the "ascii" charset '\3' is printed as "^C".
416 */
417 public char *
418prchar(c)
410{
411 c &= 0377;
412 return (chardef[c] & IS_CONTROL_CHAR);
413}
414
415/*
416 * Return the printable form of a character.
417 * For example, in the "ascii" charset '\3' is printed as "^C".
418 */
419 public char *
420prchar(c)
419 int c;
421 LWCHAR c;
420{
421 /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
422 static char buf[32];
423
424 c &= 0377;
425 if ((c < 128 || !utf_mode) && !control_char(c))
426 SNPRINTF1(buf, sizeof(buf), "%c", c);
427 else if (c == ESC)

--- 378 unchanged lines hidden (view full) ---

806 * Cn: Other, Not Assigned
807 * Zl: Separator, Line
808 * Zp: Separator, Paragraph
809 * Last synched with
810 * <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt>
811 * dated 2005-11-30T00:58:48Z
812 */
813static struct wchar_range ubin_table[] = {
422{
423 /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
424 static char buf[32];
425
426 c &= 0377;
427 if ((c < 128 || !utf_mode) && !control_char(c))
428 SNPRINTF1(buf, sizeof(buf), "%c", c);
429 else if (c == ESC)

--- 378 unchanged lines hidden (view full) ---

808 * Cn: Other, Not Assigned
809 * Zl: Separator, Line
810 * Zp: Separator, Paragraph
811 * Last synched with
812 * <http://www.unicode.org/Public/5.0.0/ucd/UnicodeData-5.0.0d7.txt>
813 * dated 2005-11-30T00:58:48Z
814 */
815static struct wchar_range ubin_table[] = {
814 { 0x0000, 0x001F} /* Cc */, { 0x007F, 0x009F} /* Cc */,
816 { 0x0000, 0x0007} /* Cc */,
817 { 0x000B, 0x000C} /* Cc */,
818 { 0x000E, 0x001A} /* Cc */,
819 { 0x001C, 0x001F} /* Cc */,
820 { 0x007F, 0x009F} /* Cc */,
815#if 0
816 { 0x00AD, 0x00AD} /* Cf */,
817#endif
818 { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */,
819 { 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */,
820 { 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */,
821 { 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */,
822 { 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */,

--- 345 unchanged lines hidden ---
821#if 0
822 { 0x00AD, 0x00AD} /* Cf */,
823#endif
824 { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */,
825 { 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */,
826 { 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */,
827 { 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */,
828 { 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */,

--- 345 unchanged lines hidden ---