help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A question about category name in ELisp


From: Eli Zaretskii
Subject: Re: A question about category name in ELisp
Date: Sun, 06 Oct 2013 18:47:45 +0300

> Date: Sun, 6 Oct 2013 12:04:25 +0800
> From: Xue Fuqiao <address@hidden>
> 
> >> >From the second paragraph, my impression about a category table is
> >> something like this:
> >>
> >> |     | a   | -   | .   | "   |
> >> |-----+-----+-----+-----+-----|
> >> | bv1 | bv2 | bv3 | bv4 | bv5 |
> >>
> >> (The first row contains the indices of the char-table (i.e., the
> >> "index C" above), and the second row contains the elements at index
> >> C1, C2, ... (i.e., it's a category set, which is a bool-vector.))
> >>
> >> As with all arrays, bool-vector indices start from 0, so CAT should be
> >> an integer.  But according to my understanding, CAT is a category
> >> name, which should be an ASCII printing character (instead of just an
> >> integer, from the first paragraph).  Why?  Am I missing something?
> >
> > You need to read about char-table, your assumption about its structure
> > is wrong.  In particular, a char-table is not a flat array, and it is
> > indexed by characters, not by zero-based integers.
> 
> Thanks, but IIUC I think bool-vector (the "category set") is not a
> char-table.  The "category table" is a char-table.

Indeed, and you've drawn a schematics of the category table above,
which is what I was alluding to.  Your picture of the category table
is incorrect, as a char-table is not a flat array.

Another thing that you seem to be missing is that every character is
also a small integer, so a bool-vector of length 128 can be indexed
by any ASCII character.  And a category set is a set of 128 slots, as
you can see by evaluating this:

  (aref (category-table) ?a)

(You can use any ASCII character instead of ?a.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]