comparison src/mule.c @ 428:3ecd8885ac67 r21-2-22

Import from CVS: tag r21-2-22
author cvs
date Mon, 13 Aug 2007 11:28:15 +0200
parents
children 8de8e3f6228a
comparison
equal deleted inserted replaced
427:0a0253eac470 428:3ecd8885ac67
1 /* Copyright (C) 1995 Free Software Foundation.
2
3 This file is part of XEmacs.
4
5 XEmacs is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
9
10 XEmacs is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with XEmacs; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
19
20 /* Synched up with: Mule 2.3. Not in FSF. */
21
22 #include <config.h>
23 #include "lisp.h"
24
25 #include "regex.h"
26
27 #ifdef MULE_REGEXP
28
29 Lisp_Object Vre_word;
30
31 int re_short_flag;
32
33
34 DEFUN ("define-word-pattern", Fdefine_word_pattern, 1, 1, 0, /*
35 Don't call this function directly, instead use 'define-word' which
36 accept a pattern compiled by 'regexp-compile' with word-option t.
37 */
38 (pattern))
39 {
40 int i, len;
41 char *p;
42 Lisp_Object temp;
43 struct Lisp_String *s;
44
45 CHECK_CONS (pattern);
46 len = XINT (Flength (pattern));
47 if (len > MAXWORDBUF)
48 error ("Too complicated regular expression for word!");
49 for (i = 0; i < len; i++)
50 {
51 temp = XCAR (pattern);
52 CHECK_VECTOR (temp);
53 CHECK_STRING (XVECTOR_DATA (temp)[0]);
54 s = XSTRING (XVECTOR_DATA (temp)[0]);
55 if (!wordbuf[i])
56 wordbuf[i] = xnew (struct re_pattern_buffer);
57 else
58 if (wordbuf[i]->buffer) xfree (wordbuf[i]->buffer);
59 wordbuf[i]->buffer = (char *) xmalloc (s->size + 1);
60 wordbuf[i]->used = s->size;
61 memcpy (wordbuf[i]->buffer, s->data, s->size + 1);
62 #ifdef EMACS19_REGEXP
63 wordbuf[i]->translate = 0;
64 wordbuf[i]->fastmap_accurate = 0;
65 wordbuf[i]->fastmap = 0;
66 wordbuf[i]->can_be_null = 1;
67
68 wordbuf[i]->mc_flag = 1;
69 wordbuf[i]->short_flag = 0;
70 wordbuf[i]->no_empty = 0;
71
72 wordbuf[i]->syntax_version = 0;
73 wordbuf[i]->category_version = 0;
74
75 wordbuf[i]->regs_allocated = REGS_UNALLOCATED;
76 wordbuf[i]->re_nsub = 0;
77 wordbuf[i]->no_sub = 0;
78 wordbuf[i]->newline_anchor = 1;
79
80 wordbuf[i]->syntax = 0;
81 wordbuf[i]->not_bol = wordbuf[i]->not_eol = 0;
82 #endif /* EMACS19_REGEXP */
83 pattern = XCDR (pattern);
84 }
85 for (; i < MAXWORDBUF && wordbuf[i]; i++)
86 {
87 if (wordbuf[i]->buffer) xfree (wordbuf[i]->buffer);
88 xfree (wordbuf[i]);
89 wordbuf[i] = (struct re_pattern_buffer *) 0;
90 }
91 return Qnil;
92 }
93
94 #endif /* MULE_REGEXP */
95
96
97 void
98 syms_of_mule (void)
99 {
100 #ifdef MULE_REGEXP
101 DEFSUBR (Fdefine_word_pattern);
102 #endif
103 }
104
105 void
106 vars_of_mule (void)
107 {
108 #ifdef MULE_REGEXP
109 DEFVAR_BOOL ("re-short-flag", &re_short_flag /*
110 *T means regexp search success when the shortest match is found.
111 */ );
112 re_short_flag = 0;
113 #endif /* MULE_REGEXP */
114
115 Fprovide (intern ("mule"));
116
117 #ifdef HAVE_EGG
118 Fprovide (intern ("egg"));
119 #endif
120 #ifdef HAVE_WNN
121 Fprovide (intern ("wnn"));
122 #endif
123 }