Mercurial > hg > xemacs-beta
comparison src/text.c @ 3571:f6cd5fe9bf4c
[xemacs-hg @ 2006-08-24 21:21:34 by aidan]
Vary support for multiple-width characters on a per-console basis.
author | aidan |
---|---|
date | Thu, 24 Aug 2006 21:21:36 +0000 |
parents | b03fc4eae965 |
children | 1fe680cefdb7 |
comparison
equal
deleted
inserted
replaced
3570:1ebada1a4643 | 3571:f6cd5fe9bf4c |
---|---|
1996 charsets[ichar_leading_byte (str[i]) - MIN_LEADING_BYTE] = 1; | 1996 charsets[ichar_leading_byte (str[i]) - MIN_LEADING_BYTE] = 1; |
1997 } | 1997 } |
1998 #endif | 1998 #endif |
1999 } | 1999 } |
2000 | 2000 |
2001 /* A couple of these functions should only be called on a non-Mule build. */ | |
2002 #ifdef MULE | |
2003 #define ASSERT_BUILT_WITH_MULE() assert(1) | |
2004 #else /* MULE */ | |
2005 #define ASSERT_BUILT_WITH_MULE() assert(0) | |
2006 #endif /* MULE */ | |
2007 | |
2001 int | 2008 int |
2002 ibyte_string_displayed_columns (const Ibyte *str, Bytecount len) | 2009 ibyte_string_displayed_columns (const Ibyte *str, Bytecount len) |
2003 { | 2010 { |
2004 int cols = 0; | 2011 int cols = 0; |
2005 const Ibyte *end = str + len; | 2012 const Ibyte *end = str + len; |
2013 Ichar ch; | |
2014 | |
2015 ASSERT_BUILT_WITH_MULE(); | |
2006 | 2016 |
2007 while (str < end) | 2017 while (str < end) |
2008 { | 2018 { |
2009 #ifdef MULE | 2019 ch = itext_ichar (str); |
2010 Ichar ch = itext_ichar (str); | |
2011 cols += XCHARSET_COLUMNS (ichar_charset (ch)); | 2020 cols += XCHARSET_COLUMNS (ichar_charset (ch)); |
2012 #else | |
2013 cols++; | |
2014 #endif | |
2015 INC_IBYTEPTR (str); | 2021 INC_IBYTEPTR (str); |
2016 } | 2022 } |
2017 | 2023 |
2018 return cols; | 2024 return cols; |
2019 } | 2025 } |
2020 | 2026 |
2021 int | 2027 int |
2022 ichar_string_displayed_columns (const Ichar *USED_IF_MULE (str), Charcount len) | 2028 ichar_string_displayed_columns (const Ichar * USED_IF_MULE(str), Charcount len) |
2023 { | 2029 { |
2024 #ifdef MULE | |
2025 int cols = 0; | 2030 int cols = 0; |
2026 int i; | 2031 int i; |
2027 | 2032 |
2033 ASSERT_BUILT_WITH_MULE(); | |
2034 | |
2028 for (i = 0; i < len; i++) | 2035 for (i = 0; i < len; i++) |
2029 cols += XCHARSET_COLUMNS (ichar_charset (str[i])); | 2036 cols += XCHARSET_COLUMNS (ichar_charset (str[i])); |
2030 | 2037 |
2031 return cols; | 2038 return cols; |
2032 #else /* not MULE */ | |
2033 return len; | |
2034 #endif | |
2035 } | 2039 } |
2036 | 2040 |
2037 Charcount | 2041 Charcount |
2038 ibyte_string_nonascii_chars (const Ibyte *USED_IF_MULE (str), | 2042 ibyte_string_nonascii_chars (const Ibyte *USED_IF_MULE (str), |
2039 Bytecount USED_IF_MULE (len)) | 2043 Bytecount USED_IF_MULE (len)) |