comparison src/search.c @ 14086:a410808fda15

(Fmatch_end, Fregexp_quote): Harmonize arguments with documentation.
author Erik Naggum <erik@naggum.no>
date Tue, 09 Jan 1996 00:33:47 +0000
parents 621a575db6f7
children ee40177f6c68
comparison
equal deleted inserted replaced
14085:85ce7bab31dc 14086:a410808fda15
1800 : search_regs.end[n])); 1800 : search_regs.end[n]));
1801 } 1801 }
1802 1802
1803 DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0, 1803 DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0,
1804 "Return position of start of text matched by last search.\n\ 1804 "Return position of start of text matched by last search.\n\
1805 NUM specifies which parenthesized expression in the last regexp.\n\ 1805 SUBEXP, a number, specifies which parenthesized expression in the last\n\
1806 Value is nil if NUMth pair didn't match, or there were less than NUM pairs.\n\ 1806 regexp.\n\
1807 Value is nil if SUBEXPth pair didn't match, or there were less than\n\
1808 SUBEXP pairs.\n\
1807 Zero means the entire text matched by the whole regexp or whole string.") 1809 Zero means the entire text matched by the whole regexp or whole string.")
1808 (num) 1810 (subexp)
1809 Lisp_Object num; 1811 Lisp_Object subexp;
1810 { 1812 {
1811 return match_limit (num, 1); 1813 return match_limit (subexp, 1);
1812 } 1814 }
1813 1815
1814 DEFUN ("match-end", Fmatch_end, Smatch_end, 1, 1, 0, 1816 DEFUN ("match-end", Fmatch_end, Smatch_end, 1, 1, 0,
1815 "Return position of end of text matched by last search.\n\ 1817 "Return position of end of text matched by last search.\n\
1816 ARG, a number, specifies which parenthesized expression in the last regexp.\n\ 1818 SUBEXP, a number, specifies which parenthesized expression in the last\n\
1817 Value is nil if ARGth pair didn't match, or there were less than ARG pairs.\n\ 1819 regexp.\n\
1820 Value is nil if SUBEXPth pair didn't match, or there were less than\n\
1821 SUBEXP pairs.\n\
1818 Zero means the entire text matched by the whole regexp or whole string.") 1822 Zero means the entire text matched by the whole regexp or whole string.")
1819 (num) 1823 (subexp)
1820 Lisp_Object num; 1824 Lisp_Object subexp;
1821 { 1825 {
1822 return match_limit (num, 0); 1826 return match_limit (subexp, 0);
1823 } 1827 }
1824 1828
1825 DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 0, 0, 1829 DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 0, 0,
1826 "Return a list containing all info on what the last search matched.\n\ 1830 "Return a list containing all info on what the last search matched.\n\
1827 Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'.\n\ 1831 Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'.\n\
1999 2003
2000 /* Quote a string to inactivate reg-expr chars */ 2004 /* Quote a string to inactivate reg-expr chars */
2001 2005
2002 DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, 2006 DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
2003 "Return a regexp string which matches exactly STRING and nothing else.") 2007 "Return a regexp string which matches exactly STRING and nothing else.")
2004 (str) 2008 (string)
2005 Lisp_Object str; 2009 Lisp_Object string;
2006 { 2010 {
2007 register unsigned char *in, *out, *end; 2011 register unsigned char *in, *out, *end;
2008 register unsigned char *temp; 2012 register unsigned char *temp;
2009 2013
2010 CHECK_STRING (str, 0); 2014 CHECK_STRING (string, 0);
2011 2015
2012 temp = (unsigned char *) alloca (XSTRING (str)->size * 2); 2016 temp = (unsigned char *) alloca (XSTRING (string)->size * 2);
2013 2017
2014 /* Now copy the data into the new string, inserting escapes. */ 2018 /* Now copy the data into the new string, inserting escapes. */
2015 2019
2016 in = XSTRING (str)->data; 2020 in = XSTRING (string)->data;
2017 end = in + XSTRING (str)->size; 2021 end = in + XSTRING (string)->size;
2018 out = temp; 2022 out = temp;
2019 2023
2020 for (; in != end; in++) 2024 for (; in != end; in++)
2021 { 2025 {
2022 if (*in == '[' || *in == ']' 2026 if (*in == '[' || *in == ']'