[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch-1_4 changeword cleanup
From: |
Eric Blake |
Subject: |
branch-1_4 changeword cleanup |
Date: |
Thu, 13 Jul 2006 22:09:27 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
I know changeword is on its last leg, but:
changeword() currently has the (not so) cool effect of crippling the input
engine (I'm not sure if it is because every character you type adds to the ever-
growing potential macro name, or because no character is recognized as being a
potential macro); there is no way to recover once you type it. I also think it
is good that changeword is currently a no-op without arguments, (since not all
m4 compilations have it, you should have to explicitly request it with
arguments), but it might as well be blind rather than warning and expanding to
void. So here's a TODO item, done.
2006-07-13 Eric Blake <address@hidden>
* src/input.c (input_init): Simplify.
(set_word_regexp): Treat empty string as default, since empty
regexp would disable word parsing.
* src/m4.c (user_word_regexp): Default to empty string.
* src/builtin.c (builtin_tab): Make changeword blind.
* NEWS: Document this.
* TODO: Knock off completed items.
Index: TODO
===================================================================
RCS file: /sources/m4/m4/TODO,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TODO
--- TODO 17 Feb 2000 03:03:19 -0000 1.1.1.1
+++ TODO 13 Jul 2006 21:59:54 -0000
@@ -1,11 +1,10 @@
TODO file for GNU m4
-Tell <address@hidden> if you feel like volunteering for any
+Tell <address@hidden> if you feel like volunteering for any
of these ideas, listed more or less in decreasing order of priority.
* Features or problems
- Update documentation from accumulated mail about it
- - Changeword without arguments should restore default behavior
- Study synclines at the very beginning of each diverted sequence
- Make eval work on bignums - the 32 bits limit is artificial
From Krste Asanovic <address@hidden>, 1993-03-20
@@ -13,8 +12,6 @@
* Optimization and clean up
- Check for memory leaks and uninitialized reads
From Vern Paxson <address@hidden> on 1993-12-06
- - Simplify format/ecvt code, together with HAVE_EFGCVT
- - Finalize the stdarg vs varargs thing
- Profile GNU m4 and speed it up
From David J. MacKenzie <address@hidden>, 1993-01-20
@@ -31,9 +28,6 @@
GNU m4 is lousy regarding NULs in streams (this would require
maintaining the string lengths, and avoiding strlen, strcpy,
etc.).
- - Clean up the obstack.[ch] code
- - Use rx.[ch] instead of regex.[ch]
- From Hal Peterson <address@hidden>, 1994-04-22
Local Variables:
mode: outline
Index: NEWS
===================================================================
RCS file: /sources/m4/m4/NEWS,v
retrieving revision 1.1.1.1.2.36
diff -u -r1.1.1.1.2.36 NEWS
--- NEWS 13 Jul 2006 21:16:41 -0000 1.1.1.1.2.36
+++ NEWS 13 Jul 2006 21:59:54 -0000
@@ -45,6 +45,8 @@
* The ifdef, divert, m4exit, substr, and translit macros now correctly
ignore extra arguments.
* The popdef and undefine macros now correctly accept multiple arguments.
+* Although changeword is on its last leg, if enabled, it now reverts to the
+ default (faster) regexp when passed the empty string.
Version 1.4.4b - 17 June 2006, by Eric Blake (CVS version 1.4.4a)
Index: src/builtin.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/builtin.c,v
retrieving revision 1.1.1.1.2.22
diff -u -r1.1.1.1.2.22 builtin.c
--- src/builtin.c 13 Jul 2006 21:16:42 -0000 1.1.1.1.2.22
+++ src/builtin.c 13 Jul 2006 21:59:54 -0000
@@ -101,7 +101,7 @@
{ "changecom", FALSE, FALSE, FALSE, m4_changecom },
{ "changequote", FALSE, FALSE, FALSE, m4_changequote },
#ifdef ENABLE_CHANGEWORD
- { "changeword", TRUE, FALSE, FALSE, m4_changeword },
+ { "changeword", TRUE, FALSE, TRUE, m4_changeword },
#endif
{ "debugmode", TRUE, FALSE, FALSE, m4_debugmode },
{ "debugfile", TRUE, FALSE, FALSE, m4_debugfile },
Index: src/input.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/input.c,v
retrieving revision 1.1.1.1.2.8
diff -u -r1.1.1.1.2.8 input.c
--- src/input.c 23 Jun 2006 13:06:10 -0000 1.1.1.1.2.8
+++ src/input.c 13 Jul 2006 21:59:55 -0000
@@ -593,10 +593,7 @@
ecomm.length = strlen (ecomm.string);
#ifdef ENABLE_CHANGEWORD
- if (user_word_regexp)
- set_word_regexp (user_word_regexp);
- else
- set_word_regexp (DEFAULT_WORD_REGEXP);
+ set_word_regexp (user_word_regexp);
#endif
}
@@ -649,7 +646,7 @@
const char *msg;
struct re_pattern_buffer new_word_regexp;
- if (!strcmp (regexp, DEFAULT_WORD_REGEXP))
+ if (!*regexp || !strcmp (regexp, DEFAULT_WORD_REGEXP))
{
default_word_regexp = TRUE;
return;
Index: src/m4.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/m4.c,v
retrieving revision 1.1.1.1.2.16
diff -u -r1.1.1.1.2.16 m4.c
--- src/m4.c 12 Jul 2006 13:14:51 -0000 1.1.1.1.2.16
+++ src/m4.c 13 Jul 2006 21:59:55 -0000
@@ -58,7 +58,7 @@
#ifdef ENABLE_CHANGEWORD
/* User provided regexp for describing m4 words. */
-const char *user_word_regexp = NULL;
+const char *user_word_regexp = "";
#endif
/* Name of frozen file to digest after initialization. */
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.40
diff -u -r1.1.1.1.2.40 m4.texinfo
--- doc/m4.texinfo 13 Jul 2006 21:16:41 -0000 1.1.1.1.2.40
+++ doc/m4.texinfo 13 Jul 2006 22:05:25 -0000
@@ -2445,7 +2445,9 @@
You should note that using @code{changeword} will slow @code{m4} down
by a factor of about seven, once it is changed to something other
-than the default regular expression.
+than the default regular expression. You can invoke @code{changeword}
+with the empty string to restore the default word definition, and regain
+the parsing speed.
+
+The builtin macro @code{changeword} is recognized only when given
+arguments.
@node M4wrap
@section Saving input
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch-1_4 changeword cleanup,
Eric Blake <=