comparison src/search.c @ 286:57709be46d1b r21-0b41

Import from CVS: tag r21-0b41
author cvs
date Mon, 13 Aug 2007 10:35:03 +0200
parents c42ec1d1cded
children a4f53d9b3154
comparison
equal deleted inserted replaced
285:9a3756523c1b 286:57709be46d1b
547 547
548 If ALLOW_QUIT is non-zero, call QUIT periodically. */ 548 If ALLOW_QUIT is non-zero, call QUIT periodically. */
549 549
550 static Bytind 550 static Bytind
551 bi_scan_buffer (struct buffer *buf, Emchar target, Bytind st, Bytind en, 551 bi_scan_buffer (struct buffer *buf, Emchar target, Bytind st, Bytind en,
552 int count, int *shortage, int allow_quit) 552 EMACS_INT count, EMACS_INT *shortage, int allow_quit)
553 { 553 {
554 /* This function has been Mule-ized. */ 554 /* This function has been Mule-ized. */
555 Bytind lim = en > 0 ? en : 555 Bytind lim = en > 0 ? en :
556 ((count > 0) ? BI_BUF_ZV (buf) : BI_BUF_BEGV (buf)); 556 ((count > 0) ? BI_BUF_ZV (buf) : BI_BUF_BEGV (buf));
557 557
666 } 666 }
667 } 667 }
668 668
669 Bufpos 669 Bufpos
670 scan_buffer (struct buffer *buf, Emchar target, Bufpos start, Bufpos end, 670 scan_buffer (struct buffer *buf, Emchar target, Bufpos start, Bufpos end,
671 int count, int *shortage, int allow_quit) 671 EMACS_INT count, EMACS_INT *shortage, int allow_quit)
672 { 672 {
673 Bytind bi_retval; 673 Bytind bi_retval;
674 Bytind bi_start, bi_end; 674 Bytind bi_start, bi_end;
675 675
676 bi_start = bufpos_to_bytind (buf, start); 676 bi_start = bufpos_to_bytind (buf, start);
684 } 684 }
685 685
686 Bytind 686 Bytind
687 bi_find_next_newline_no_quit (struct buffer *buf, Bytind from, int cnt) 687 bi_find_next_newline_no_quit (struct buffer *buf, Bytind from, int cnt)
688 { 688 {
689 return bi_scan_buffer (buf, '\n', from, 0, cnt, (int *) 0, 0); 689 return bi_scan_buffer (buf, '\n', from, 0, cnt, 0, 0);
690 } 690 }
691 691
692 Bufpos 692 Bufpos
693 find_next_newline_no_quit (struct buffer *buf, Bufpos from, int cnt) 693 find_next_newline_no_quit (struct buffer *buf, Bufpos from, int cnt)
694 { 694 {
695 return scan_buffer (buf, '\n', from, 0, cnt, (int *) 0, 0); 695 return scan_buffer (buf, '\n', from, 0, cnt, 0, 0);
696 } 696 }
697 697
698 Bufpos 698 Bufpos
699 find_next_newline (struct buffer *buf, Bufpos from, int cnt) 699 find_next_newline (struct buffer *buf, Bufpos from, int cnt)
700 { 700 {
701 return scan_buffer (buf, '\n', from, 0, cnt, (int *) 0, 1); 701 return scan_buffer (buf, '\n', from, 0, cnt, 0, 1);
702 } 702 }
703 703
704 /* Like find_next_newline, but returns position before the newline, 704 /* Like find_next_newline, but returns position before the newline,
705 not after, and only search up to TO. This isn't just 705 not after, and only search up to TO. This isn't just
706 find_next_newline (...)-1, because you might hit TO. */ 706 find_next_newline (...)-1, because you might hit TO. */
707 Bufpos 707 Bufpos
708 find_before_next_newline (struct buffer *buf, Bufpos from, Bufpos to, int cnt) 708 find_before_next_newline (struct buffer *buf, Bufpos from, Bufpos to, int cnt)
709 { 709 {
710 int shortage; 710 EMACS_INT shortage;
711 Bufpos pos = scan_buffer (buf, '\n', from, to, cnt, &shortage, 1); 711 Bufpos pos = scan_buffer (buf, '\n', from, to, cnt, &shortage, 1);
712 712
713 if (shortage == 0) 713 if (shortage == 0)
714 pos--; 714 pos--;
715 715
744 if (XINT (lim) < BUF_BEGV (buf)) 744 if (XINT (lim) < BUF_BEGV (buf))
745 lim = make_int (BUF_BEGV (buf)); 745 lim = make_int (BUF_BEGV (buf));
746 746
747 p = XSTRING_DATA (string); 747 p = XSTRING_DATA (string);
748 pend = p + XSTRING_LENGTH (string); 748 pend = p + XSTRING_LENGTH (string);
749 xzero (fastmap); 749 memset (fastmap, 0, sizeof (fastmap));
750 750
751 Fclear_range_table (Vskip_chars_range_table); 751 Fclear_range_table (Vskip_chars_range_table);
752 752
753 if (p != pend && *p == '^') 753 if (p != pend && *p == '^')
754 { 754 {