XEmacs 21.4.17 "Jumbo Shrimp".
[chise/xemacs-chise.git.1] / src / mule-charset.c
index 1949e90..c541628 100644 (file)
@@ -445,8 +445,9 @@ static const struct lrecord_description charset_description[] = {
 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
                                mark_charset, print_charset, 0, 0, 0, charset_description,
                               Lisp_Charset);
-/* Make a new charset. */
 
+/* Make a new charset. */
+/* #### SJT Should generic properties be allowed? */
 static Lisp_Object
 make_charset (int id, Lisp_Object name, unsigned char rep_bytes,
              unsigned char type, unsigned char columns, unsigned char graphic,
@@ -507,15 +508,22 @@ get_unallocated_leading_byte (int dimension)
 
   if (dimension == 1)
     {
-      if (chlook->next_allocated_1_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_1)
+      if (chlook->next_allocated_1_byte_leading_byte >
+         MAX_LEADING_BYTE_PRIVATE_1)
        lb = 0;
       else
        lb = chlook->next_allocated_1_byte_leading_byte++;
     }
   else
     {
-      if (chlook->next_allocated_2_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_2)
-       lb = 0;
+      /* awfully fragile, but correct */
+#if MAX_LEADING_BYTE_PRIVATE_2 == 255
+      if (chlook->next_allocated_2_byte_leading_byte == 0)
+#else
+      if (chlook->next_allocated_2_byte_leading_byte >
+         MAX_LEADING_BYTE_PRIVATE_2)
+#endif
+        lb = 0;
       else
        lb = chlook->next_allocated_2_byte_leading_byte++;
     }
@@ -617,6 +625,7 @@ Return the name of charset CHARSET.
   return XCHARSET_NAME (Fget_charset (charset));
 }
 
+/* #### SJT Should generic properties be allowed? */
 DEFUN ("make-charset", Fmake_charset, 3, 3, 0, /*
 Define a new character set.
 This function is for use with Mule support.
@@ -691,7 +700,7 @@ character set.  Recognized properties are:
            short_name = value;
          }
 
-       if (EQ (keyword, Qlong_name))
+       else if (EQ (keyword, Qlong_name))
          {
            CHECK_STRING (value);
            long_name = value;
@@ -961,7 +970,7 @@ Return dimension of CHARSET.
 }
 
 DEFUN ("charset-property", Fcharset_property, 2, 2, 0, /*
-Return property PROP of CHARSET.
+Return property PROP of CHARSET, a charset object or symbol naming a charset.
 Recognized properties are those listed in `make-charset', as well as
 'name and 'doc-string.
 */
@@ -989,10 +998,8 @@ Recognized properties are those listed in `make-charset', as well as
   if (EQ (prop, Qreverse_direction_charset))
     {
       Lisp_Object obj = CHARSET_REVERSE_DIRECTION_CHARSET (cs);
-      if (NILP (obj))
-       return Qnil;
-      else
-       return XCHARSET_NAME (obj);
+      /* #### Is this translation OK?  If so, error checking sufficient? */
+      return CHARSETP (obj) ? XCHARSET_NAME (obj) : obj;
     }
   signal_simple_error ("Unrecognized charset property name", prop);
   return Qnil; /* not reached */
@@ -1320,8 +1327,8 @@ vars_of_mule_charset (void)
 {
   int i, j, k;
 
-  chlook = xnew (struct charset_lookup);
-  dumpstruct (&chlook, &charset_lookup_description);
+  chlook = xnew_and_zero (struct charset_lookup); /* zero for Purify. */
+  dump_add_root_struct_ptr (&chlook, &charset_lookup_description);
 
   /* Table of charsets indexed by leading byte. */
   for (i = 0; i < countof (chlook->charset_by_leading_byte); i++)