1 /* Copyright (C) 1995 Free Software Foundation.
3 This file is part of SXEmacs
5 SXEmacs is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 SXEmacs is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 /* Synched up with: Mule 2.3. Not in FSF. */
32 DEFUN("define-word-pattern", Fdefine_word_pattern, 1, 1, 0, /*
33 Don't call this function directly, instead use 'define-word' which
34 accept a pattern compiled by 'regexp-compile' with word-option t.
44 len = XINT(Flength(pattern));
46 error("Too complicated regular expression for word!");
47 for (i = 0; i < len; i++) {
50 CHECK_STRING(XVECTOR_DATA(temp)[0]);
51 s = XSTRING(XVECTOR_DATA(temp)[0]);
53 wordbuf[i] = xnew(struct re_pattern_buffer);
54 else if (wordbuf[i]->buffer)
55 xfree(wordbuf[i]->buffer);
56 wordbuf[i]->buffer = (char *)xmalloc_atomic(s->size + 1);
57 wordbuf[i]->used = s->size;
58 memcpy(wordbuf[i]->buffer, s->data, s->size + 1);
60 wordbuf[i]->translate = 0;
61 wordbuf[i]->fastmap_accurate = 0;
62 wordbuf[i]->fastmap = 0;
63 wordbuf[i]->can_be_null = 1;
65 wordbuf[i]->mc_flag = 1;
66 wordbuf[i]->short_flag = 0;
67 wordbuf[i]->no_empty = 0;
69 wordbuf[i]->syntax_version = 0;
70 wordbuf[i]->category_version = 0;
72 wordbuf[i]->regs_allocated = REGS_UNALLOCATED;
73 wordbuf[i]->re_nsub = 0;
74 wordbuf[i]->no_sub = 0;
75 wordbuf[i]->newline_anchor = 1;
77 wordbuf[i]->syntax = 0;
78 wordbuf[i]->not_bol = wordbuf[i]->not_eol = 0;
79 #endif /* EMACS19_REGEXP */
80 pattern = XCDR(pattern);
82 for (; i < MAXWORDBUF && wordbuf[i]; i++) {
83 if (wordbuf[i]->buffer)
84 xfree(wordbuf[i]->buffer);
86 wordbuf[i] = (struct re_pattern_buffer *)0;
91 #endif /* MULE_REGEXP */
93 void syms_of_mule(void)
96 DEFSUBR(Fdefine_word_pattern);
100 void vars_of_mule(void)
103 DEFVAR_BOOL("re-short-flag", &re_short_flag /*
104 *T means regexp search success when the shortest match is found.
107 #endif /* MULE_REGEXP */
109 Fprovide(intern("mule"));
112 Fprovide(intern("egg"));
115 Fprovide(intern("wnn"));