1/* |
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) |
396 LWCHAR c; |
397{ |
398 if (utf_mode) 399 return (is_ubin_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) |
409 LWCHAR 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) |
421 LWCHAR c; |
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[] = { |
816 { 0x0000, 0x0007} /* Cc */, 817 { 0x000B, 0x000C} /* Cc */, 818 { 0x000E, 0x001A} /* Cc */, 819 { 0x001C, 0x001F} /* Cc */, 820 { 0x007F, 0x009F} /* Cc */, |
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 --- |