comparison src/syntax.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents 6728e641994e
children 79c6ff3eef26
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
91 /* This is the internal form of the parse state used in parse-partial-sexp. */ 91 /* This is the internal form of the parse state used in parse-partial-sexp. */
92 92
93 struct lisp_parse_state 93 struct lisp_parse_state
94 { 94 {
95 int depth; /* Depth at end of parsing */ 95 int depth; /* Depth at end of parsing */
96 Emchar instring; /* -1 if not within string, else desired terminator */ 96 Ichar instring; /* -1 if not within string, else desired terminator */
97 int incomment; /* Nonzero if within a comment at end of parsing */ 97 int incomment; /* Nonzero if within a comment at end of parsing */
98 int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE */ 98 int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE */
99 int quoted; /* Nonzero if just after an escape char at end of 99 int quoted; /* Nonzero if just after an escape char at end of
100 parsing */ 100 parsing */
101 Charbpos thislevelstart;/* Char number of most recent start-of-expression 101 Charbpos thislevelstart;/* Char number of most recent start-of-expression
588 } 588 }
589 589
590 #endif 590 #endif
591 591
592 Lisp_Object 592 Lisp_Object
593 syntax_match (Lisp_Object syntax_table, Emchar ch) 593 syntax_match (Lisp_Object syntax_table, Ichar ch)
594 { 594 {
595 Lisp_Object code = get_char_table (ch, syntax_table); 595 Lisp_Object code = get_char_table (ch, syntax_table);
596 Lisp_Object code2 = code; 596 Lisp_Object code2 = code;
597 597
598 if (CONSP (code)) 598 if (CONSP (code))
629 /* Return 1 if there is a word boundary between two word-constituent 629 /* Return 1 if there is a word boundary between two word-constituent
630 characters C1 and C2 if they appear in this order, else return 0. 630 characters C1 and C2 if they appear in this order, else return 0.
631 There is no word boundary between two word-constituent ASCII 631 There is no word boundary between two word-constituent ASCII
632 characters. */ 632 characters. */
633 #define WORD_BOUNDARY_P(c1, c2) \ 633 #define WORD_BOUNDARY_P(c1, c2) \
634 (!(emchar_ascii_p (c1) && emchar_ascii_p (c2)) \ 634 (!(ichar_ascii_p (c1) && ichar_ascii_p (c2)) \
635 && word_boundary_p (c1, c2)) 635 && word_boundary_p (c1, c2))
636 #endif 636 #endif
637 637
638 /* Return the position across COUNT words from FROM. 638 /* Return the position across COUNT words from FROM.
639 If that many words cannot be found before the end of the buffer, return 0. 639 If that many words cannot be found before the end of the buffer, return 0.
641 641
642 Charbpos 642 Charbpos
643 scan_words (struct buffer *buf, Charbpos from, int count) 643 scan_words (struct buffer *buf, Charbpos from, int count)
644 { 644 {
645 Charbpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf); 645 Charbpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf);
646 Emchar ch0, ch1; 646 Ichar ch0, ch1;
647 enum syntaxcode code; 647 enum syntaxcode code;
648 struct syntax_cache *scache = setup_buffer_syntax_cache (buf, from, count); 648 struct syntax_cache *scache = setup_buffer_syntax_cache (buf, from, count);
649 649
650 /* #### is it really worth it to hand expand both cases? JV */ 650 /* #### is it really worth it to hand expand both cases? JV */
651 while (count > 0) 651 while (count > 0)
788 788
789 static int 789 static int
790 find_start_of_comment (struct buffer *buf, Charbpos from, Charbpos stop, 790 find_start_of_comment (struct buffer *buf, Charbpos from, Charbpos stop,
791 int comstyle) 791 int comstyle)
792 { 792 {
793 Emchar c; 793 Ichar c;
794 enum syntaxcode code; 794 enum syntaxcode code;
795 795
796 /* Look back, counting the parity of string-quotes, 796 /* Look back, counting the parity of string-quotes,
797 and recording the comment-starters seen. 797 and recording the comment-starters seen.
798 When we reach a safe place, assume that's not in a string; 798 When we reach a safe place, assume that's not in a string;
801 801
802 OFROM[I] is position of the earliest comment-starter seen 802 OFROM[I] is position of the earliest comment-starter seen
803 which is I+2X quotes from the comment-end. 803 which is I+2X quotes from the comment-end.
804 PARITY is current parity of quotes from the comment end. */ 804 PARITY is current parity of quotes from the comment end. */
805 int parity = 0; 805 int parity = 0;
806 Emchar my_stringend = 0; 806 Ichar my_stringend = 0;
807 int string_lossage = 0; 807 int string_lossage = 0;
808 Charbpos comment_end = from; 808 Charbpos comment_end = from;
809 Charbpos comstart_pos = 0; 809 Charbpos comstart_pos = 0;
810 int comstart_parity = 0; 810 int comstart_parity = 0;
811 int styles_match_p = 0; 811 int styles_match_p = 0;
1063 */ 1063 */
1064 (count, buffer)) 1064 (count, buffer))
1065 { 1065 {
1066 Charbpos from; 1066 Charbpos from;
1067 Charbpos stop; 1067 Charbpos stop;
1068 Emchar c; 1068 Ichar c;
1069 enum syntaxcode code; 1069 enum syntaxcode code;
1070 int syncode; 1070 int syncode;
1071 EMACS_INT n; 1071 EMACS_INT n;
1072 struct buffer *buf = decode_buffer (buffer, 0); 1072 struct buffer *buf = decode_buffer (buffer, 0);
1073 struct syntax_cache *scache; 1073 struct syntax_cache *scache;
1253 Lisp_Object 1253 Lisp_Object
1254 scan_lists (struct buffer *buf, Charbpos from, int count, int depth, 1254 scan_lists (struct buffer *buf, Charbpos from, int count, int depth,
1255 int sexpflag, int noerror) 1255 int sexpflag, int noerror)
1256 { 1256 {
1257 Charbpos stop; 1257 Charbpos stop;
1258 Emchar c; 1258 Ichar c;
1259 int quoted; 1259 int quoted;
1260 int mathexit = 0; 1260 int mathexit = 0;
1261 enum syntaxcode code; 1261 enum syntaxcode code;
1262 int syncode; 1262 int syncode;
1263 int min_depth = depth; /* Err out if depth gets less than this. */ 1263 int min_depth = depth; /* Err out if depth gets less than this. */
1398 break; 1398 break;
1399 1399
1400 case Sstring_fence: 1400 case Sstring_fence:
1401 case Sstring: 1401 case Sstring:
1402 { 1402 {
1403 Emchar stringterm; 1403 Ichar stringterm;
1404 1404
1405 if (code != Sstring_fence) 1405 if (code != Sstring_fence)
1406 { 1406 {
1407 /* XEmacs change: call syntax_match on character */ 1407 /* XEmacs change: call syntax_match on character */
1408 Emchar ch = BUF_FETCH_CHAR (buf, from - 1); 1408 Ichar ch = BUF_FETCH_CHAR (buf, from - 1);
1409 Lisp_Object stermobj = 1409 Lisp_Object stermobj =
1410 syntax_match (scache->current_syntax_table, ch); 1410 syntax_match (scache->current_syntax_table, ch);
1411 1411
1412 if (CHARP (stermobj)) 1412 if (CHARP (stermobj))
1413 stringterm = XCHAR (stermobj); 1413 stringterm = XCHAR (stermobj);
1578 break; 1578 break;
1579 1579
1580 case Sstring_fence: 1580 case Sstring_fence:
1581 case Sstring: 1581 case Sstring:
1582 { 1582 {
1583 Emchar stringterm; 1583 Ichar stringterm;
1584 1584
1585 if (code != Sstring_fence) 1585 if (code != Sstring_fence)
1586 { 1586 {
1587 /* XEmacs change: call syntax_match() on character */ 1587 /* XEmacs change: call syntax_match() on character */
1588 Emchar ch = BUF_FETCH_CHAR (buf, from); 1588 Ichar ch = BUF_FETCH_CHAR (buf, from);
1589 Lisp_Object stermobj = 1589 Lisp_Object stermobj =
1590 syntax_match (scache->current_syntax_table, ch); 1590 syntax_match (scache->current_syntax_table, ch);
1591 1591
1592 if (CHARP (stermobj)) 1592 if (CHARP (stermobj))
1593 stringterm = XCHAR (stermobj); 1593 stringterm = XCHAR (stermobj);
1734 (buffer)) 1734 (buffer))
1735 { 1735 {
1736 struct buffer *buf = decode_buffer (buffer, 0); 1736 struct buffer *buf = decode_buffer (buffer, 0);
1737 Charbpos beg = BUF_BEGV (buf); 1737 Charbpos beg = BUF_BEGV (buf);
1738 Charbpos pos = BUF_PT (buf); 1738 Charbpos pos = BUF_PT (buf);
1739 Emchar c = '\0'; /* initialize to avoid compiler warnings */ 1739 Ichar c = '\0'; /* initialize to avoid compiler warnings */
1740 struct syntax_cache *scache; 1740 struct syntax_cache *scache;
1741 1741
1742 scache = setup_buffer_syntax_cache (buf, pos, -1); 1742 scache = setup_buffer_syntax_cache (buf, pos, -1);
1743 1743
1744 while (pos > beg && !char_quoted (buf, pos - 1) 1744 while (pos > beg && !char_quoted (buf, pos - 1)
1860 } 1860 }
1861 if (start_quoted) goto startquoted; 1861 if (start_quoted) goto startquoted;
1862 1862
1863 while (from < end) 1863 while (from < end)
1864 { 1864 {
1865 Emchar c; 1865 Ichar c;
1866 int syncode; 1866 int syncode;
1867 1867
1868 QUIT; 1868 QUIT;
1869 1869
1870 UPDATE_SYNTAX_CACHE_FORWARD (scache, from); 1870 UPDATE_SYNTAX_CACHE_FORWARD (scache, from);
2008 state.instring = ST_STRING_STYLE; 2008 state.instring = ST_STRING_STYLE;
2009 } 2009 }
2010 else 2010 else
2011 { 2011 {
2012 /* XEmacs change: call syntax_match() on character */ 2012 /* XEmacs change: call syntax_match() on character */
2013 Emchar ch = BUF_FETCH_CHAR (buf, from - 1); 2013 Ichar ch = BUF_FETCH_CHAR (buf, from - 1);
2014 Lisp_Object stermobj = 2014 Lisp_Object stermobj =
2015 syntax_match (scache->current_syntax_table, ch); 2015 syntax_match (scache->current_syntax_table, ch);
2016 2016
2017 if (CHARP (stermobj)) 2017 if (CHARP (stermobj))
2018 state.instring = XCHAR (stermobj); 2018 state.instring = XCHAR (stermobj);
2375 } 2375 }
2376 2376
2377 void 2377 void
2378 complex_vars_of_syntax (void) 2378 complex_vars_of_syntax (void)
2379 { 2379 {
2380 Emchar i; 2380 Ichar i;
2381 const char *p; 2381 const char *p;
2382 /* Set this now, so first buffer creation can refer to it. */ 2382 /* Set this now, so first buffer creation can refer to it. */
2383 /* Make it nil before calling copy-syntax-table 2383 /* Make it nil before calling copy-syntax-table
2384 so that copy-syntax-table will know not to try to copy from garbage */ 2384 so that copy-syntax-table will know not to try to copy from garbage */
2385 Vstandard_syntax_table = Qnil; 2385 Vstandard_syntax_table = Qnil;