#summary A list of functions which are called by the other parts of Vim. = Introduction = These 15 functions currently are the interface of Vim's regexp engine. They are all defined in regexp.c and declared in proto/regexp.pro. It is listed below where and how many times each function is called by other files after each function is explained. As you can see, they are not of the same importance: some are called more, some less. So we probably should first focus on the more important ones. ǂ = Needs to be tested = Details = *TODO:* * explain void free_regexp_stuff __ARGS((void)); ====regprog_T * vim_regcomp(expr, re_flags)==== * char_u {{{*}}}*expr* * int *re_flags* _RE{{{_}}}MAGIC and/or RE{{{_}}}STRING._ Compile a regular expression into internal code. Returns the program in allocated space. Returns NULL for an error. Called in: * buffer.c:2:match buffer names * edit.c:2:insert completion? * eval.c:5 * ex_cmds.c:1 * ex_cmds2.c:2 * ex_docmd.c:2 * ex_eval.c:1 * ex_getln.c:2 * fileio.c:3:autocmd file pattern? * gui.c:1 * misc1.c:3 * option.c:2 * quickfix.c:3 * search.c:5 * spell.c:4 * syntax.c:3 * tag.c:1 ====int vim_regexec(rmp, line, col)==== * regmatch_T {{{*}}} *rmp* _rmp->regprog is a compiled regexp as returned by vim_regcomp()_ * char_u {{{*}}} *line* _string to match against_ * colnr_T *col* _column to start looking for match_ Called in: * buffer.c:2:match buffer names(see also vim_regcomp) * edit.c:1:insertion completion? * eval.c:1 * ex_cmds.c:5 * ex_cmds2.c:2 * ex_docmd.c:1 * ex_eval.c:1 * ex_getln.c:3 * fileio.c:3:autocmd file pattern? * getchar.c:2 * misc1.c:3 * option.c:7 * quickfix.c:3 * screen.c:1 * search.c:6 * spell.c:5 * syntax.c:1 * tag.c:2 * os_unix.c:1 ====ǂ int vim_regcomp_had_eol()==== Check if during the previous call to vim_regcomp the EOL item "$" has been found. This is messy, but it works fine. Called in: * syntax.c:2 Match a regexp against a string. Return TRUE if there is a match, FALSE if not. ====ǂ int vim_regexec_nl(rmp, line, col)==== Like vim_regexec(), but consider a "\n" in "line" to be a line break. Called in: * eval.c:4 * ex_eval.c:1 * gui.c:1 ====long vim_regexec_multi(rmp, win, buf, lnum, col)==== * regmatch_T {{{*}}} *rmp* _rmp->regprog is a compiled regexp as returned by vim_regcomp()_ * win_T {{{*}}} *win* _window in which to search or NULL_ * buf_T {{{*}}} *buf* _buffer in which to search_ * linenr_T *lnum* _nr of line to start looking for match_ * colnr_T *col* _column to start looking for match_ Match a regexp against multiple lines. Return zero if there is no match. Return number of lines contained in the match otherwise. Called in: * ex_cmds.c:4 * misc1.c:1 * quickfix.c:1 * screen.c:1 * search.c:3 * syntax.c:1 ====ǂ int vim_regsub(rmp, source, dest, copy, magic, backslash)==== * regmatch_T {{{*}}} *rmp* * char_u {{{*}}} *source* * char_u {{{*}}} *dest* * int *copy* _If TRUE, really copy into *dest*. If FALSE nothing is copied, this is just to find out the length of the result._ * int *magic* * int *backslash* _If TRUE, a backslash will be removed later, need to double them to keep them, and insert a backslash before a CR to avoid it being replaced with a line break later._ Perform substitutions after a vim_regexec() or vim_regexec_multi() match. Returns the size of the replacement, including terminating NUL. Note: The matched text must not change between the call of vim_regexec()/vim_regexec_multi() and vim_regsub()! It would make the back references invalid! Called in: * eval.c:2 * ex_cmds.c:2 ====ǂ int vim_regsub_multi(rmp, lnum, source, dest, copy, magic, backslash)==== * linenr{{{_}}}T *lnum* _nr of line to start looking for a match_ Presumably like vim_regsub, but operates over multiple lines. Called in: * ex_cmds.c:2 ====int re_lookbehind(prog)==== * regprog_T {{{*}}} *prog* Return TRUE if compiled regular expression "prog" looks before the start position (pattern contains "\@<=" or "\@