Mercurial > hg > xemacs-beta
comparison src/mule.c @ 70:131b0175ea99 r20-0b30
Import from CVS: tag r20-0b30
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:02:59 +0200 |
parents | |
children | 538048ae2ab8 |
comparison
equal
deleted
inserted
replaced
69:804d1389bcd6 | 70:131b0175ea99 |
---|---|
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 =XCONS (pattern)->car; | |
52 CHECK_VECTOR (temp); | |
53 CHECK_STRING (XVECTOR (temp)->contents[0]); | |
54 s = XSTRING (XVECTOR (temp)->contents[0]); | |
55 if (!wordbuf[i]) | |
56 wordbuf[i] = (struct re_pattern_buffer *) | |
57 xmalloc (sizeof (struct re_pattern_buffer)); | |
58 else | |
59 if (wordbuf[i]->buffer) xfree (wordbuf[i]->buffer); | |
60 wordbuf[i]->buffer = (char *) xmalloc (s->size + 1); | |
61 wordbuf[i]->used = s->size; | |
62 memcpy (wordbuf[i]->buffer, s->data, s->size + 1); | |
63 #ifdef EMACS19_REGEXP | |
64 wordbuf[i]->translate = 0; | |
65 wordbuf[i]->fastmap_accurate = 0; | |
66 wordbuf[i]->fastmap = 0; | |
67 wordbuf[i]->can_be_null = 1; | |
68 | |
69 wordbuf[i]->mc_flag = 1; | |
70 wordbuf[i]->short_flag = 0; | |
71 wordbuf[i]->no_empty = 0; | |
72 | |
73 wordbuf[i]->syntax_version = 0; | |
74 wordbuf[i]->category_version = 0; | |
75 | |
76 wordbuf[i]->regs_allocated = REGS_UNALLOCATED; | |
77 wordbuf[i]->re_nsub = 0; | |
78 wordbuf[i]->no_sub = 0; | |
79 wordbuf[i]->newline_anchor = 1; | |
80 | |
81 wordbuf[i]->syntax = 0; | |
82 wordbuf[i]->not_bol = wordbuf[i]->not_eol = 0; | |
83 #endif /* EMACS19_REGEXP */ | |
84 pattern = XCONS (pattern)->cdr; | |
85 } | |
86 for (; i < MAXWORDBUF && wordbuf[i]; i++) | |
87 { | |
88 if (wordbuf[i]->buffer) xfree (wordbuf[i]->buffer); | |
89 xfree (wordbuf[i]); | |
90 wordbuf[i] = (struct re_pattern_buffer *) 0; | |
91 } | |
92 return Qnil; | |
93 } | |
94 | |
95 #endif /* MULE_REGEXP */ | |
96 | |
97 | |
98 void | |
99 syms_of_mule (void) | |
100 { | |
101 #ifdef MULE_REGEXP | |
102 DEFSUBR (Fdefine_word_pattern); | |
103 #endif | |
104 } | |
105 | |
106 void | |
107 vars_of_mule (void) | |
108 { | |
109 #ifdef MULE_REGEXP | |
110 DEFVAR_BOOL ("re-short-flag", &re_short_flag /* | |
111 *T means regexp search success when the shortest match is found. | |
112 */ ); | |
113 re_short_flag = 0; | |
114 #endif /* MULE_REGEXP */ | |
115 | |
116 Vfeatures = Fcons (intern ("mule"), Vfeatures); | |
117 | |
118 #ifdef HAVE_EGG | |
119 Vfeatures = Fcons (intern ("egg"), Vfeatures); | |
120 #endif | |
121 #ifdef HAVE_WNN | |
122 Vfeatures = Fcons (intern ("wnn"), Vfeatures); | |
123 #endif | |
124 #ifdef HAVE_SJ3 | |
125 Vfeatures = Fcons (intern "sj3"), Vfeatures); | |
126 #endif | |
127 } |