changeset 3540:efa52de8c279

[xemacs-hg @ 2006-08-04 20:01:05 by aidan] Handle Latin-1 in syntax.c; make guillemets string delimiters.
author aidan
date Fri, 04 Aug 2006 20:01:14 +0000
parents 9a4534f784c2
children 02f6568ceaab
files lisp/ChangeLog lisp/iso8859-1.el src/ChangeLog src/syntax.c
diffstat 4 files changed, 62 insertions(+), 129 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Aug 03 21:51:11 2006 +0000
+++ b/lisp/ChangeLog	Fri Aug 04 20:01:14 2006 +0000
@@ -1,3 +1,9 @@
+2006-08-04  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* iso8859-1.el:
+	Move the symbol table modification to three lines at the end of
+	syntax.c. 
+
 2006-07-16  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* loadhist.el (symbol-file):
--- a/lisp/iso8859-1.el	Thu Aug 03 21:51:11 2006 +0000
+++ b/lisp/iso8859-1.el	Fri Aug 04 20:01:14 2006 +0000
@@ -1,6 +1,6 @@
-;;; iso8859-1.el --- Set case and syntax tables for Latin 1
+;;; iso8859-1.el --- Set syntax table for Latin 1
 
-;; Copyright (C) 1992, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1997, 2006 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@jwz.org>
 ;; Created: 19-aug-92
@@ -24,124 +24,16 @@
 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ;; 02111-1307, USA.
 
-;;; Synched up with:  Not synched
+;;; Synched up with:  Not in FSF. 
 
 ;;; Commentary:
 
 ;; created by jwz, 19-aug-92.
-;; Sets the case and syntax tables for the ISO-8859/1 character set.
+;; Sets the case table for the ISO-8859/1 character set.
+;; Used to set the syntax table. 
 
 ;;; Code:
 
-(let ((table (standard-syntax-table)))
-  ;;
-  ;; The symbol characters
-  ;;
-  (modify-syntax-entry ?\240 "_"     table)   ; nobreakspace
-  (modify-syntax-entry ?\241 "."     table)   ; exclamdown
-  (modify-syntax-entry ?\242 "_"     table)   ; cent
-  (modify-syntax-entry ?\243 "_"     table)   ; sterling
-  (modify-syntax-entry ?\244 "_"     table)   ; currency
-  (modify-syntax-entry ?\245 "_"     table)   ; yen
-  (modify-syntax-entry ?\246 "_"     table)   ; brokenbar
-  (modify-syntax-entry ?\247 "_"     table)   ; section
-  (modify-syntax-entry ?\250 "_"     table)   ; diaeresis
-  (modify-syntax-entry ?\251 "_"     table)   ; copyright
-  (modify-syntax-entry ?\252 "_"     table)   ; ordfeminine
-  (modify-syntax-entry ?\253 "(\273" table)   ; guillemotleft
-  (modify-syntax-entry ?\254 "_"     table)   ; notsign
-  (modify-syntax-entry ?\255 "_"     table)   ; hyphen
-  (modify-syntax-entry ?\256 "_"     table)   ; registered
-  (modify-syntax-entry ?\257 "_"     table)   ; macron
-  (modify-syntax-entry ?\260 "_"     table)   ; degree
-  (modify-syntax-entry ?\261 "_"     table)   ; plusminus
-  (modify-syntax-entry ?\262 "_"     table)   ; twosuperior
-  (modify-syntax-entry ?\263 "_"     table)   ; threesuperior
-  (modify-syntax-entry ?\264 "_"     table)   ; acute
-  (modify-syntax-entry ?\265 "_"     table)   ; mu
-  (modify-syntax-entry ?\266 "_"     table)   ; paragraph
-  (modify-syntax-entry ?\267 "_"     table)   ; periodcentered
-  (modify-syntax-entry ?\270 "_"     table)   ; cedilla
-  (modify-syntax-entry ?\271 "_"     table)   ; onesuperior
-  (modify-syntax-entry ?\272 "_"     table)   ; masculine
-  (modify-syntax-entry ?\273 ")\253" table)   ; guillemotright
-  (modify-syntax-entry ?\274 "_"     table)   ; onequarter
-  (modify-syntax-entry ?\275 "_"     table)   ; onehalf
-  (modify-syntax-entry ?\276 "_"     table)   ; threequarters
-  (modify-syntax-entry ?\277 "_"     table)   ; questiondown
-  ;;
-  ;; the upper-case characters (plus "multiply" and "ssharp") 
-  ;;
-  (modify-syntax-entry ?\300 "w" table)   ; Agrave
-  (modify-syntax-entry ?\301 "w" table)   ; Aacute
-  (modify-syntax-entry ?\302 "w" table)   ; Acircumflex
-  (modify-syntax-entry ?\303 "w" table)   ; Atilde
-  (modify-syntax-entry ?\304 "w" table)   ; Adiaeresis
-  (modify-syntax-entry ?\305 "w" table)   ; Aring
-  (modify-syntax-entry ?\306 "w" table)   ; AE
-  (modify-syntax-entry ?\307 "w" table)   ; Ccedilla
-  (modify-syntax-entry ?\310 "w" table)   ; Egrave
-  (modify-syntax-entry ?\311 "w" table)   ; Eacute
-  (modify-syntax-entry ?\312 "w" table)   ; Ecircumflex
-  (modify-syntax-entry ?\313 "w" table)   ; Ediaeresis
-  (modify-syntax-entry ?\314 "w" table)   ; Igrave
-  (modify-syntax-entry ?\315 "w" table)   ; Iacute
-  (modify-syntax-entry ?\316 "w" table)   ; Icircumflex
-  (modify-syntax-entry ?\317 "w" table)   ; Idiaeresis
-  (modify-syntax-entry ?\320 "w" table)   ; ETH
-  (modify-syntax-entry ?\321 "w" table)   ; Ntilde
-  (modify-syntax-entry ?\322 "w" table)   ; Ograve
-  (modify-syntax-entry ?\323 "w" table)   ; Oacute
-  (modify-syntax-entry ?\324 "w" table)   ; Ocircumflex
-  (modify-syntax-entry ?\325 "w" table)   ; Otilde
-  (modify-syntax-entry ?\326 "w" table)   ; Odiaeresis
-  (modify-syntax-entry ?\327 "_" table)   ; multiply
-  (modify-syntax-entry ?\330 "w" table)   ; Ooblique
-  (modify-syntax-entry ?\331 "w" table)   ; Ugrave
-  (modify-syntax-entry ?\332 "w" table)   ; Uacute
-  (modify-syntax-entry ?\333 "w" table)   ; Ucircumflex
-  (modify-syntax-entry ?\334 "w" table)   ; Udiaeresis
-  (modify-syntax-entry ?\335 "w" table)   ; Yacute
-  (modify-syntax-entry ?\336 "w" table)   ; THORN
-  (modify-syntax-entry ?\337 "w" table)   ; ssharp
-  ;;
-  ;; the lower-case characters (plus "division" and "ydiaeresis")
-  ;;
-  (modify-syntax-entry ?\340 "w" table)   ; agrave
-  (modify-syntax-entry ?\341 "w" table)   ; aacute
-  (modify-syntax-entry ?\342 "w" table)   ; acircumflex
-  (modify-syntax-entry ?\343 "w" table)   ; atilde
-  (modify-syntax-entry ?\344 "w" table)   ; adiaeresis
-  (modify-syntax-entry ?\345 "w" table)   ; aring
-  (modify-syntax-entry ?\346 "w" table)   ; ae
-  (modify-syntax-entry ?\347 "w" table)   ; ccedilla
-  (modify-syntax-entry ?\350 "w" table)   ; egrave
-  (modify-syntax-entry ?\351 "w" table)   ; eacute
-  (modify-syntax-entry ?\352 "w" table)   ; ecircumflex
-  (modify-syntax-entry ?\353 "w" table)   ; ediaeresis
-  (modify-syntax-entry ?\354 "w" table)   ; igrave
-  (modify-syntax-entry ?\355 "w" table)   ; iacute
-  (modify-syntax-entry ?\356 "w" table)   ; icircumflex
-  (modify-syntax-entry ?\357 "w" table)   ; idiaeresis
-  (modify-syntax-entry ?\360 "w" table)   ; eth
-  (modify-syntax-entry ?\361 "w" table)   ; ntilde
-  (modify-syntax-entry ?\362 "w" table)   ; ograve
-  (modify-syntax-entry ?\363 "w" table)   ; oacute
-  (modify-syntax-entry ?\364 "w" table)   ; ocircumflex
-  (modify-syntax-entry ?\365 "w" table)   ; otilde
-  (modify-syntax-entry ?\366 "w" table)   ; odiaeresis
-  (modify-syntax-entry ?\367 "_" table)   ; division
-  (modify-syntax-entry ?\370 "w" table)   ; ooblique
-  (modify-syntax-entry ?\371 "w" table)   ; ugrave
-  (modify-syntax-entry ?\372 "w" table)   ; uacute
-  (modify-syntax-entry ?\373 "w" table)   ; ucircumflex
-  (modify-syntax-entry ?\374 "w" table)   ; udiaeresis
-  (modify-syntax-entry ?\375 "w" table)   ; yacute
-  (modify-syntax-entry ?\376 "w" table)   ; thorn
-  (modify-syntax-entry ?\377 "w" table)   ; ydiaeresis
-  )
-
-
 (defconst iso8859/1-case-table nil
   "The case table for ISO-8859/1 characters.")
 
--- a/src/ChangeLog	Thu Aug 03 21:51:11 2006 +0000
+++ b/src/ChangeLog	Fri Aug 04 20:01:14 2006 +0000
@@ -1,3 +1,17 @@
+2006-08-04  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* syntax.c (Fsyntax_table_p):
+	Make the docstring better reflect the code. 
+	* syntax.c (define_standard_syntax):
+	Take a const UExtbyte * as the first argument, not a const char *
+
+	* syntax.c (complex_vars_of_syntax):
+	Use a macro instead of repeating code; don't redundantly set the
+	syntax of the alphanumeric characters to ?w; define syntax for
+	Latin 1 characters here instead of in Lisp; guillemets are string
+	delimiters, not parentheses.
+
+
 2006-07-18  Marcus Crestani  <crestani@xemacs.org>
 
 	* .cvsignore: Add .dbxrc.in and .gdbinit.in.
--- a/src/syntax.c	Thu Aug 03 21:51:11 2006 +0000
+++ b/src/syntax.c	Fri Aug 04 20:01:14 2006 +0000
@@ -146,7 +146,6 @@
 
 DEFUN ("syntax-table-p", Fsyntax_table_p, 1, 1, 0, /*
 Return t if OBJECT is a syntax table.
-Any vector of 256 elements will do.
 */
        (object))
 {
@@ -2451,7 +2450,7 @@
 }
 
 static void
-define_standard_syntax (const char *p, enum syntaxcode syn)
+define_standard_syntax (const UExtbyte *p, enum syntaxcode syn)
 {
   for (; *p; p++)
     Fput_char_table (make_char (*p), make_int (syn), Vstandard_syntax_table);
@@ -2461,10 +2460,19 @@
 complex_vars_of_syntax (void)
 {
   Ichar i;
-  const char *p;
-  /* Set this now, so first buffer creation can refer to it. */
-  /* Make it nil before calling copy-syntax-table
-     so that copy-syntax-table will know not to try to copy from garbage */
+  const UExtbyte *p; /* Latin-1, not internal format. */
+
+#define SET_RANGE_SYNTAX(start, end, syntax)				\
+  do {									\
+    for (i = start; i <= end; i++)					\
+      Fput_char_table(make_char(i), make_int(syntax),			\
+		      Vstandard_syntax_table);				\
+  } while (0)
+
+  /* Set this now, so first buffer creation can refer to it. 
+
+     Make it nil before calling copy-syntax-table so that copy-syntax-table
+     will know not to try to copy from garbage */
   Vstandard_syntax_table = Qnil;
   Vstandard_syntax_table = Fcopy_syntax_table (Qnil);
   staticpro (&Vstandard_syntax_table);
@@ -2476,19 +2484,18 @@
 							Smax);
   staticpro (&Vsyntax_designator_chars_string);
 
+  /* Default character syntax is word. */
   set_char_table_default (Vstandard_syntax_table, make_int (Sword));
 
-  for (i = 0; i <= 32; i++)	/* Control 0 plus SPACE */
-    Fput_char_table (make_char (i), make_int (Swhitespace),
-		     Vstandard_syntax_table);
-  for (i = 127; i <= 159; i++)	/* DEL plus Control 1 */
-    Fput_char_table (make_char (i), make_int (Swhitespace),
-		     Vstandard_syntax_table);
+  /* Control 0; treat as punctuation */
+  SET_RANGE_SYNTAX(0, 32, Spunct);
 
-  define_standard_syntax ("abcdefghijklmnopqrstuvwxyz"
-			  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-			  "0123456789"
-			  "$%", Sword);
+  /* The whitespace--overwriting some of the above changes. */
+  define_standard_syntax(" \t\015\014", Swhitespace);
+
+  /* DEL plus Control 1 */
+  SET_RANGE_SYNTAX(127, 159, Spunct);
+
   define_standard_syntax ("\"", Sstring);
   define_standard_syntax ("\\", Sescape);
   define_standard_syntax ("_-+*/&|<>=", Ssymbol);
@@ -2503,4 +2510,18 @@
 		       Fcons (make_int (Sclose), make_char (p[0])),
 		       Vstandard_syntax_table);
     }
+
+  /* Latin 1 "symbols." This contrasts with the FSF, where they're word
+     constituents. */
+  SET_RANGE_SYNTAX(0240, 0277, Ssymbol); 
+
+  /* The guillemets. These are not parentheses, in contrast to what the old
+     code did. */
+  define_standard_syntax("\253\273", Sstring);
+
+  /* The inverted exclamation mark, and the multiplication and division
+     signs. */
+  define_standard_syntax("\241\327\367", Spunct);
+
+#undef SET_RANGE_SYNTAX  
 }