From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: A question about category name in ELisp Date: Sun, 06 Oct 2013 18:47:45 +0300 Message-ID: <83y5665rku.fsf@gnu.org> References: <83k3hr7uvk.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1381074499 366 80.91.229.3 (6 Oct 2013 15:48:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Oct 2013 15:48:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 06 17:48:22 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VSqZB-0001p6-KE for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Oct 2013 17:48:21 +0200 Original-Received: from localhost ([::1]:55583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSqZB-0004w5-6o for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Oct 2013 11:48:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSqYu-0004v3-Cn for help-gnu-emacs@gnu.org; Sun, 06 Oct 2013 11:48:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSqYk-0003K8-GG for help-gnu-emacs@gnu.org; Sun, 06 Oct 2013 11:48:04 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:53713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSqYk-0003Jt-7b for help-gnu-emacs@gnu.org; Sun, 06 Oct 2013 11:47:54 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MU900M007JJY700@a-mtaout21.012.net.il> for help-gnu-emacs@gnu.org; Sun, 06 Oct 2013 18:47:52 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MU900MD37VSS560@a-mtaout21.012.net.il> for help-gnu-emacs@gnu.org; Sun, 06 Oct 2013 18:47:52 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:93873 Archived-At: > Date: Sun, 6 Oct 2013 12:04:25 +0800 > From: Xue Fuqiao > > >> >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.)