QUERY
Aidan,
While I'm here ... do you have test cases you could add to
tests/automated/mule-tests.el?
I needed a patch to build under --with-union-type, where I get a
return type mismatch in charset-property.
Only the the last hunk
- if (EQ (prop, Qencode_as_utf_8)) return CHARSET_ENCODE_AS_UTF_8 (cs);
+ if (EQ (prop, Qencode_as_utf_8))
+ return CHARSET_ENCODE_AS_UTF_8 (cs) ? Qt : Qnil;
is essential. I think (charset-property 'encode-as-utf-8) will return
zero if it's 1, and a crash if it's zero, as is. If you really think of
this as a 1-bit integer :-), that hunk could be replaced with
something like
- if (EQ (prop, Qencode_as_utf_8)) return CHARSET_ENCODE_AS_UTF_8 (cs);
+ if (EQ (prop, Qencode_as_utf_8))
+ return make_int (CHARSET_ENCODE_AS_UTF_8 (cs));
and you could ignore the rest, but I think `encode-as-utf-8' is
conceptually a Boolean property, so I prefer this approach.
The `graphic' property should get the same treatment as direction
(with symbols 'left and 'right), but that's ancient usage and I don't
feel like grepping the world today, especially since your patch isn't
even in yet. ;-)
dh237% git diff
diff --git a/src/mule-charset.c b/src/mule-charset.c
index d97dee4..339b55e 100644
--- a/src/mule-charset.c
+++ b/src/mule-charset.c
@@ -240,7 +240,7 @@ make_charset (int id, Lisp_Object name,
CHARSET_FINAL (cs) = final;
CHARSET_DOC_STRING (cs) = doc;
CHARSET_REGISTRY (cs) = reg;
- CHARSET_ENCODE_AS_UTF_8 (cs) = encode_as_utf_8;
+ CHARSET_ENCODE_AS_UTF_8 (cs) = encode_as_utf_8 ? 1 : 0;
CHARSET_CCL_PROGRAM (cs) = Qnil;
CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil;
@@ -456,8 +456,8 @@ character set. Recognized properties ar
bit cleared and set depending upon whether the value
of the `graphic' property is 0 or 1.
`encode-as-utf-8'
- If 1, the charset will be written out using the UTF-8 escape
- syntax in ISO 2022-oriented coding systems. Used for
+ If non-nil, the charset will be written out using the UTF-8
+ escape syntax in ISO 2022-oriented coding systems. Used for
supporting characters we know are part of Unicode but not of
any other known character set in escape-quoted and compound
text.
@@ -556,10 +556,7 @@ character set. Recognized properties ar
else if (EQ (keyword, Qencode_as_utf_8))
{
- CHECK_INT (value);
- encode_as_utf_8 = XINT (value);
- if (encode_as_utf_8 < 0 || encode_as_utf_8 > 1)
- invalid_constant ("Invalid value for `encode-as-utf-8'", value);
+ encode_as_utf_8 = NILP (value) ? 0 : 1;
}
else if (EQ (keyword, Qfinal))
@@ -824,7 +821,8 @@ Recognized properties are those listed i
if (EQ (prop, Qfinal)) return make_char (CHARSET_FINAL (cs));
if (EQ (prop, Qchars)) return make_int (CHARSET_CHARS (cs));
if (EQ (prop, Qregistry)) return CHARSET_REGISTRY (cs);
- if (EQ (prop, Qencode_as_utf_8)) return CHARSET_ENCODE_AS_UTF_8 (cs);
+ if (EQ (prop, Qencode_as_utf_8))
+ return CHARSET_ENCODE_AS_UTF_8 (cs) ? Qt : Qnil;
if (EQ (prop, Qccl_program)) return CHARSET_CCL_PROGRAM (cs);
if (EQ (prop, Qdirection))
return CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? Ql2r : Qr2l;
--
School of Systems and Information Engineering
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.