[PATCH] Update man page for init file, one nroff format error
17 years, 6 months
Shyamal Prasad
etc/ChangeLog addition:
2004-12-03 Shyamal Prasad <shyamal(a)member.fsf.org>
* xemacs.1: Now describe $HOME/.xemacs/init.el as the
preferred init file. Fixed excessive space insertion
in the description of the '-vanilla' option
XEmacs source patch:
Diff command: cvs -q diff -u
Files affected: etc/xemacs.1
Index: etc/xemacs.1
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/etc/xemacs.1,v
retrieving …
[View More]revision 1.13
diff -u -r1.13 xemacs.1
--- etc/xemacs.1 2001/04/12 18:20:52 1.13
+++ etc/xemacs.1 2004/12/04 01:33:45
@@ -147,12 +147,7 @@
.TP
.B \-vanilla
Load no extra files at startup. Equivalent to the combination of
-.B \-q
-,
-.B \-no-site-file
-, and
-.B \-no-early-packages
-\.
+.BR \-q ", " \-no-site-file ", and " \-no-early-packages .
.TP
.BI \-u " user, " \-user " user"
Load
@@ -628,7 +623,8 @@
META-left Make a rectangular selection.
.SH FILES
Lisp code is read at startup from the user's init file,
-\fB$HOME/.emacs\fP.
+\fB$HOME/.xemacs/init.el\fP. If this file does not exist then
+\fB$HOME/.emacs\fP will be read if it is present.
/usr/local/info - files for the Info documentation browser
(a subsystem of
[View Less]
[PATCH] Synch up format-time-string % specifiers with Emacs 21.3.1
17 years, 6 months
Shyamal Prasad
This patch adds % specifiers to format-time-string that are missing in
XEmacs but supported by Emacs 21.3.1
src/ChangeLog addition:
2004-12-08 Shyamal Prasad <shyamal(a)member.fsf.org>
* editfns.c:
* editfns.c (Fformat_time_string):
Added documentation for %z, %g, %G and %V specifiers. This synchs
up the set of % specifiers for format-time-string with Emacs
21.3.1. Make copy of static buffer returned by localtime().
* strftime.c:
* strftime.c (strftime):
Implemented %z, %g,…
[View More] %G and %V in a style similar to existing
implementation of other specifiers.
XEmacs source patch:
Diff command: cvs -q diff -u
Files affected: src/strftime.c src/editfns.c
Index: src/editfns.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/editfns.c,v
retrieving revision 1.51
diff -u -r1.51 editfns.c
--- src/editfns.c 2004/12/06 03:52:03 1.51
+++ src/editfns.c 2004/12/09 02:40:17
@@ -1015,6 +1015,8 @@
%d is replaced by the day of month, zero-padded.
%D is a synonym for "%m/%d/%y".
%e is replaced by the day of month, blank-padded.
+%G is replaced by the year containing the ISO 8601 week
+%g is replaced by the year of the ISO 8601 week within the century (00-99)
%h is a synonym for "%b".
%H is replaced by the hour (00-23).
%I is replaced by the hour (00-12).
@@ -1033,12 +1035,14 @@
%t is a synonym for "\\t".
%T is a synonym for "%H:%M:%S".
%U is replaced by the week of the year (00-53), first day of week is Sunday.
+%V is replaced by the ISO 8601 week number
%w is replaced by the day of week (0-6), Sunday is day 0.
%W is replaced by the week of the year (00-53), first day of week is Monday.
%x is a locale-specific synonym, which defaults to "%D" in the C locale.
%X is a locale-specific synonym, which defaults to "%T" in the C locale.
%y is replaced by the year without century (00-99).
%Y is replaced by the year with century.
+%z is replaced by the time zone as a numeric offset (e.g +0530, -0800 etc.)
%Z is replaced by the time zone abbreviation.
The number of options reflects the `strftime' function.
@@ -1063,13 +1067,15 @@
{
Extbyte *buf = alloca_extbytes (size);
Extbyte *formext;
+ /* make a copy of the static buffer returned by localtime() */
+ struct tm tm = * localtime(&value);
+
*buf = 1;
/* !!#### this use of external here is not totally safe, and
potentially data lossy. */
LISP_STRING_TO_EXTERNAL (format_string, formext, Qnative);
- if (emacs_strftime (buf, size, formext,
- localtime (&value))
+ if (emacs_strftime (buf, size, formext, &tm)
|| !*buf)
return build_ext_string (buf, Qnative);
/* If buffer was too small, make it bigger. */
Index: src/strftime.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/strftime.c,v
retrieving revision 1.6
diff -u -r1.6 strftime.c
--- src/strftime.c 2002/03/29 04:48:37 1.6
+++ src/strftime.c 2004/12/09 02:40:18
@@ -58,6 +58,7 @@
%S second (00..61)
%T time, 24-hour (hh:mm:ss)
%X locale's time representation (%H:%M:%S)
+ %z time zone offset (e.g. +0530, -0800 etc)
%Z time zone (EDT), or nothing if no time zone is determinable
Date fields:
@@ -70,10 +71,13 @@
%d day of month (01..31)
%e day of month ( 1..31)
%D date (mm/dd/yy)
+ %G year corresponding to the ISO 8601 week
+ %g Year of the ISO 8601 week within century (00 - 99)
%h same as %b
%j day of year (001..366)
%m month (01..12)
%U week number of year with Sunday as first day of week (00..53)
+ %V ISO 8601 week number (first week is the earliest one with Thu)
%w day of week (0..6)
%W week number of year with Monday as first day of week (00..53)
%x locale's date representation (mm/dd/yy)
@@ -235,6 +239,30 @@
return dl <= 0 ? 0 : dl / 7 + (dl % 7 != 0);
}
+#ifndef __isleap
+/* Nonzero if YEAR is a leap year (every 4 years,
+ except every 100th isn't, and every 400th is). */
+# define __isleap(year) \
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#endif
+
+/* The number of days from the first day of the first ISO week of this
+ year to the year day YDAY with week day WDAY. ISO weeks start on
+ Monday; the first ISO week has the year's first Thursday. YDAY may
+ be as small as YDAY_MINIMUM. */
+#define ISO_WEEK_START_WDAY 1 /* Monday */
+#define ISO_WEEK1_WDAY 4 /* Thursday */
+#define YDAY_MINIMUM (-366)
+static int
+iso_week_days (int yday, int wday)
+{
+ /* Add enough to the first operand of % to make it nonnegative. */
+ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
+ return (yday
+ - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+ + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
+}
+
#if !defined(HAVE_TM_ZONE) && !defined(HAVE_TZNAME)
char *zone_name (const struct tm *tp);
char *
@@ -362,10 +390,125 @@
length +=
strftime (&string[length], max - length, "%H:%M:%S", tm);
break;
+
+ case 'V':
+ case 'g':
+ case 'G':
+ {
+ int year = tm->tm_year + 1900;
+ int days = iso_week_days (tm->tm_yday, tm->tm_wday);
+
+ if (days < 0)
+ {
+ /* This ISO week belongs to the previous year. */
+ year--;
+ days =
+ iso_week_days (tm->tm_yday + (365 + __isleap (year)),
+ tm->tm_wday);
+ }
+ else
+ {
+ int d =
+ iso_week_days (tm->tm_yday - (365 + __isleap (year)),
+ tm->tm_wday);
+ if (0 <= d)
+ {
+ /* This ISO week belongs to the next year. */
+ year++;
+ days = d;
+ }
+ }
+
+ switch (*format)
+ {
+ /*
+ #### FIXME
+ We really can't assume 1000 <= year <= 9999
+ once time_t gets beyond 32 bits, but it's true
+ of the rest of the code here so get with the
+ program
+ */
+ case 'g':
+ length +=
+ add_num2 (&string[length], year % 100,
+ max - length, pad);
+ break;
+
+ case 'G':
+ add_char (year / 1000 + '0');
+ length += add_num3 (&string[length], year % 1000,
+ max - length, zero);
+ break;
+
+ default:
+ length +=
+ add_num2 (&string[length], days / 7 + 1,
+ max - length, pad);
+ break;
+ }
+ }
+ break;
case 'X':
length +=
strftime (&string[length], max - length, "%H:%M:%S", tm);
break;
+ case 'z':
+ {
+ /*
+ #### FIXME: could use tm->tm_gmtoff if present. Since
+ the other code in xemacs does not do so we follow the
+ leaders (and don't add a autoconf macro to detect
+ its presence).
+ */
+ long int offset;
+ long int minutes;
+ struct tm lt, *ut;
+ time_t utc;
+
+ lt = *tm;
+ utc = mktime(<);
+ ut = gmtime(&utc);
+ /* assume that tm is valid so the others will be too! */
+ assert( utc != (time_t) -1 && ut != NULL );
+
+ /* tm diff code below is based on mktime.c, glibc 2.3.2 */
+ {
+ int lt4, ut4, lt100, ut100, lt400, ut400;
+ int intervening_leap_days, years, days;
+
+ lt4 = (lt.tm_year >> 2) + (1900 >> 2) -
+ ! (lt.tm_year & 3);
+ ut4 = (ut->tm_year >> 2) + (1900 >> 2) -
+ ! (ut->tm_year & 3);
+ lt100 = lt4 / 25 - (lt4 % 25 < 0);
+ ut100 = ut4 / 25 - (ut4 % 25 < 0);
+ lt400 = lt100 >> 2;
+ ut400 = ut100 >> 2;
+ intervening_leap_days =
+ (lt4 - ut4) - (lt100 - ut100) + (lt400 - ut400);
+ years = lt.tm_year - ut->tm_year;
+ days = (365 * years + intervening_leap_days
+ + (lt.tm_yday - ut->tm_yday));
+ offset = (60 * (60 * (24 * days + (lt.tm_hour - ut->tm_hour))
+ + (lt.tm_min - ut->tm_min))
+ + (lt.tm_sec - ut->tm_sec));
+ }
+
+ minutes = offset / ( offset < 0 ? -60 : 60 );
+
+ add_char ((offset < 0 ? '-' : '+'));
+
+ if ( minutes / 600 != 0 )
+ add_char (minutes / 600 + '0');
+ else if ( pad != none )
+ add_char ((pad == zero ? '0' : ' '));
+
+ length +=
+ add_num3 (&string[length],
+ ((minutes / 60 ) % 10) * 100 + (minutes % 60),
+ max - length, pad);
+ break;
+ }
case 'Z':
#ifdef HAVE_TM_ZONE
length += add_str (&string[length], tm->tm_zone, max - length);
[View Less]
[R21.4] revert derived-mode-merge-syntax-tables patch
19 years, 4 months
Stephen J. Turnbull
RECOMMEND 21.4
The original patch apparently slipped into 21.4 inadvertantly (see
<87r7hobebk.fsf(a)tleepslib.sk.tsukuba.ac.jp> on XEmacs Beta). This
reverts.
Note that Jerry's test in <pslluyhzan.fsf(a)diannao.ittc.ku.edu>
http://list-archive.xemacs.org/xemacs-beta/200307/msg00153.html
is 99% incorrect; `push' will always return non-nil, causing
`map-char-table' to exit after one iteration. It should be
(let ((keyval nil))
(map-char-table
#'(lambda (key value)
(…
[View More]push (list key value) keyval)
;; force null return
nil)
(make-syntax-table))
keyval)
Jerry's version still shows that map-char-table in 21.5 is broken,
because the test should return a one-element list, and it doesn't.
The revised version of derived.el DTRT's on this test:
(require 'jde)
(let ((my-syntax-table (make-syntax-table)))
(derived-mode-merge-syntax-tables java-mode-syntax-table my-syntax-table)
my-syntax-table)
and cannot throw the wrong-type error Hrvoje observes, so I recommend
application.
Index: lisp/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.515
diff -u -U0 -r1.515 ChangeLog
--- lisp/ChangeLog 17 Jul 2003 14:41:23 -0000 1.515
+++ lisp/ChangeLog 18 Jul 2003 07:19:59 -0000
@@ -0,0 +1,6 @@
+2005-04-06 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * derived.el (derived-mode-merge-syntax-tables):
+ Revert my 21.5-only patch of 2003-07-18 which slipped in
+ through Jerry James's patch of 2004-06-07.
+
Index: lisp/derived.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/derived.el,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 derived.el
--- lisp/derived.el 22 Jun 2004 01:49:47 -0000 1.4.2.1
+++ lisp/derived.el 6 Apr 2005 07:01:34 -0000
@@ -421,20 +421,12 @@
;; check for inheritance.
(map-char-table
#'(lambda (key value)
- (let ((newval (get-range-char-table key new 'multi)))
- (cond ((eq newval 'multi) ; OK, dive into the class hierarchy
- (map-char-table
- #'(lambda (key1 value1)
- (when (eq ?@ (char-syntax-from-code
- (get-range-char-table key new ?@)))
- (put-char-table key1 value new))
- nil)
- new
- key))
- ((eq ?@ (char-syntax-from-code newval)) ;; class at once
- (put-char-table key value new))))
- nil)
- old))
+ (if (eq ?@ (char-syntax-from-code value))
+ (map-char-table #'(lambda (key1 value1)
+ (put-char-table key1 value1 new))
+ old
+ key)))
+ new))
;; Merge an old abbrev table into a new one.
;; This function requires internal knowledge of how abbrev tables work,
--
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
[View Less]
[COMMIT] Mule-CCL couldn't handle control-1 characters either.
19 years, 4 months
Aidan Kehoe
NOTE: This patch has been committed.
APPROVE COMMIT
RECOMMEND 21.4, SXEmacs
I was aware CCL was doing something like this for a long time; I just told
myself that the code was part of XEmacs, it must be me who was getting stuff
wrong.
There’s an EBCDIC coding system, for example, at
http://parhasard.net/ebcdic-na.el that works after this change has been
applied. Also, writing a Windows-1252 coding system now becomes possible.
src/ChangeLog addition:
2005-04-05 Aidan Kehoe <kehoea(a)…
[View More]parhasard.net>
* mule-ccl.c (ccl_driver): Calculate the charset and position code
for control-1 characters properly, both when reading multibyte
characters and writing them.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/mule-ccl.c
Index: src/mule-ccl.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-ccl.c,v
retrieving revision 1.25
diff -u -u -r1.25 mule-ccl.c
--- src/mule-ccl.c 2004/09/20 19:19:52 1.25
+++ src/mule-ccl.c 2005/04/05 17:34:57
@@ -1302,6 +1302,13 @@
reg[RRR] = i;
reg[rrr] = (*src++ & 0x7F);
}
+ else if (LEADING_BYTE_CONTROL_1 == i)
+ {
+ if (src >= src_end)
+ goto ccl_read_multibyte_character_suspend;
+ reg[RRR] = i;
+ reg[rrr] = (*src++ - 0xA0);
+ }
else if (i <= MAX_LEADING_BYTE_OFFICIAL_2)
{
if ((src + 1) >= src_end)
@@ -1349,7 +1356,7 @@
case CCL_WriteMultibyteChar2:
i = reg[RRR]; /* charset */
- if (i == LEADING_BYTE_ASCII)
+ if (i == LEADING_BYTE_ASCII || i == LEADING_BYTE_CONTROL_1)
i = reg[rrr] & 0xFF;
else if (XCHARSET_DIMENSION (charset_by_leading_byte (i)) == 1)
i = (((i - FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7)
--
“I, for instance, am gung-ho about open source because my family is being
held hostage in Rob Malda’s basement. But who fact-checks me, or Enderle,
when we say something in public? No-one!” -- Danny O’Brien
[View Less]
[COMMIT] Cleanup of the CCL coding system example.
19 years, 4 months
Aidan Kehoe
NOTE: This patch has been committed.
APPROVE COMMIT 21.5 RECOMMEND 21.4
This has been in my queue for far too long.
man/ChangeLog addition:
2005-03-26 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/mule.texi (CCL Example):
char-int -> char-to-int, and hex 41 is decimal 64, both problems
with my previous patch pointed out by Stephen.
* lispref/mule.texi (The actual coding system):
Give information on the make-coding-system call, and where the
actual package can be found.
…
[View More]
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: man/lispref/mule.texi
Index: man/lispref/mule.texi
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/man/lispref/mule.texi,v
retrieving revision 1.12
diff -u -u -r1.12 mule.texi
--- man/lispref/mule.texi 2005/03/09 05:36:50 1.12
+++ man/lispref/mule.texi 2005/03/26 16:16:17
@@ -2097,7 +2097,7 @@
* Characters to be preserved:: No transformation needed for these characters.
* The program to decode to internal format:: .
* The program to encode from internal format:: .
-
+* The actual coding system:: .
@end menu
@node Four bits to ASCII, URI Encoding constants, , CCL Example
@@ -2117,7 +2117,7 @@
(let ((val (make-vector 256 0))
(i 0))
(while (< i (length val))
- (aset val i (char-int (aref (format "%02X" i) 0)))
+ (aset val i (char-to-int (aref (format "%02X" i) 0)))
(setq i (1+ i)))
val)
"Table to find an ASCII version of an octet's most significant 4 bits.")
@@ -2125,7 +2125,7 @@
The next table, @code{url-coding-low-order-nybble-as-ascii} is almost
the same thing, but this time it has a map for the hex encoding of the
-low-order four bits. So the sixty-fifth entry (offset @samp{#x51}) is
+low-order four bits. So the sixty-fifth entry (offset @samp{#x41}) is
the ASCII encoding of `1', the hundred-and-twenty-second (offset
@samp{#x7a}) is the ASCII encoding of `A'.
@@ -2134,7 +2134,7 @@
(let ((val (make-vector 256 0))
(i 0))
(while (< i (length val))
- (aset val i (char-int (aref (format "%02X" i) 1)))
+ (aset val i (char-to-int (aref (format "%02X" i) 1)))
(setq i (1+ i)))
val)
"Table to find an ASCII version of an octet's least significant 4 bits.")
@@ -2154,14 +2154,14 @@
@code{url-coding-escaped-space-code} variable.
@example
-(defvar url-coding-escape-character-code (char-int ?%)
+(defvar url-coding-escape-character-code (char-to-int ?%)
"The code point for the percentage sign, in ASCII.")
-(defvar url-coding-escaped-space-code (char-int ?+)
+(defvar url-coding-escaped-space-code (char-to-int ?+)
"The URL-encoded value of the space character, that is, +.")
@end example
-@node Numeric to ASCII-hexadecimal conversion
+@node Numeric to ASCII-hexadecimal conversion, Characters to be preserved, URI Encoding constants, CCL Example
@subsubsection Numeric to ASCII-hexadecimal conversion
Now, we have a couple of utility tables that wouldn't be necessary in
@@ -2177,7 +2177,7 @@
(let ((i 0)
(val (make-vector 16 0)))
(while (< i 16)
- (aset val i (char-int (aref (format "%X" i) 0)))
+ (aset val i (char-to-int (aref (format "%X" i) 0)))
(setq i (1+ i)))
val)
"A map from a hexadecimal digit's numeric value to its encoding in ASCII.")
@@ -2193,7 +2193,7 @@
"A map from Latin 1 code points to their values as hexadecimal digits.")
@end example
-@node Characters to be preserved
+@node Characters to be preserved, The program to decode to internal format, Numeric to ASCII-hexadecimal conversion, CCL Example
@subsubsection Characters to be preserved
And finally, the last of these tables. URL encoding says that
@@ -2227,7 +2227,7 @@
octet as its ASCII encoding.")
@end example
-@node The program to decode to internal format
+@node The program to decode to internal format, The program to encode from internal format, Characters to be preserved, CCL Example
@subsubsection The program to decode to internal format
After the almost interminable tables, we get to the CCL. The first
@@ -2288,7 +2288,7 @@
internal encoding. ")
@end example
-@node The program to encode from internal format
+@node The program to encode from internal format, The actual coding system, The program to decode to internal format, CCL Example
@subsubsection The program to encode from internal format
Next, we see the CCL program to encode ASCII text as URL coded text.
@@ -2323,6 +2323,36 @@
(repeat))))
"CCL program to encode octets (almost) according to RFC 1738")
@end example
+
+@node The actual coding system, , The program to encode from internal format, CCL Example
+@subsubsection The actual coding system
+
+To actually create the coding system, we call
+@samp{make-coding-system}. The first argument is the symbol that is to
+be the name of the coding system, in our case @samp{url-coding}. The
+second specifies that the coding system is to be of type
+@samp{ccl}---there are several other coding system types available,
+including, see the documentation for @samp{make-coding-system} for the
+full list. Then there's a documentation string describing the wherefore
+and caveats of the coding system, and the final argument is a property
+list giving information about the CCL programs and the coding system's
+mnemonic.
+
+@example
+(make-coding-system
+ 'url-coding 'ccl
+ "The coding used by application/x-www-form-urlencoded HTTP applications.
+This coding form doesn't specify anything about non-ASCII characters, so
+make sure you've transformed to a seven-bit coding system first."
+ '(decode ccl-decode-urlcoding
+ encode ccl-encode-urlcoding
+ mnemonic "URLenc"))
+@end example
+
+If you're lucky, the @samp{url-coding} coding system describe here
+should be available in the XEmacs package system. Otherwise, downloading
+it from @samp{http://www.parhasard.net/url-coding.el} should work for
+the foreseeable future.
@node Category Tables, Unicode Support, CCL, MULE
@section Category Tables
--
“I, for instance, am gung-ho about open source because my family is being
held hostage in Rob Malda’s basement. But who fact-checks me, or Enderle,
when we say something in public? No-one!” -- Danny O’Brien
[View Less]
[COMMIT] Don't delete everything from the popup menu in easy-menu-remove
19 years, 4 months
Aidan Kehoe
NOTE: This patch has been committed.
Also affects 21.4, and is worth considering for it.
lisp/ChangeLog addition:
2005-03-25 Ralf Angeli <angeli(a)iwi.uni-sb.de>
* easymenu.el (easy-menu-remove): As described in
E1D4Nn5-0001lq-EU(a)neutrino.iwi.uni-sb.de; don't strip everything
except the "Command" menu from mode-popup-menu.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: lisp/easymenu.el
Index: lisp/easymenu.el
====================================…
[View More]===============================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/easymenu.el,v
retrieving revision 1.7
diff -u -u -r1.7 easymenu.el
--- lisp/easymenu.el 2005/02/03 05:03:38 1.7
+++ lisp/easymenu.el 2005/03/25 16:12:14
@@ -203,7 +203,7 @@
"Remove MENU from the current menu bar."
(when (featurep 'menubar)
(setq easy-menu-all-popups (delq menu easy-menu-all-popups)
- mode-popup-menu (if (< (length easy-menu-all-popups) 1)
+ mode-popup-menu (if (> (length easy-menu-all-popups) 1)
(cons (easy-menu-title)
(reverse easy-menu-all-popups))
(let ((same-as-menu
--
“I, for instance, am gung-ho about open source because my family is being
held hostage in Rob Malda’s basement. But who fact-checks me, or Enderle,
when we say something in public? No-one!” -- Danny O’Brien
[View Less]
[COMMIT] Fix pixel-to-point conversion arithmetic in font.el
19 years, 4 months
Aidan Kehoe
APPROVE COMMIT 21.5
NOTE: This patch has been committed.
This should be considered for 21.4, Vin.
lisp/ChangeLog addition:
2005-03-25 Ralf Angeli <angeli(a)iwi.uni-sb.de>
* font.el (font-spatial-to-canonical): Correct calculation of
return value for pixel-based input value.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: lisp/font.el
Index: lisp/font.el
===================================================================
RCS file: /…
[View More]pack/xemacscvs/XEmacs/xemacs/lisp/font.el,v
retrieving revision 1.16
diff -u -u -r1.16 font.el
--- lisp/font.el 2005/01/28 02:58:40 1.16
+++ lisp/font.el 2005/03/25 15:56:05
@@ -311,8 +311,8 @@
a number, it is interpreted as the desired point size and returned unchanged.
Otherwise SPEC must be a string consisting of a number and an optional type.
The type may be the strings \"px\", \"pix\", or \"pixel\" (pixels), \"pt\" or
-\"point\" (points), \"pa\" or \"pica\" (picas), \"in\" or \"inch\" (inches), \"cm\"
-(centimeters), or \"mm\" (millimeters).
+\"point\" (points), \"pa\" or \"pica\" (picas), \"in\" or \"inch\" (inches),
+\"cm\" (centimeters), or \"mm\" (millimeters).
1 in = 2.54 cm = 6 pa = 25.4 mm = 72 pt. Pixel size is device-dependent."
(cond
@@ -351,7 +351,7 @@
(setq num (string-to-number spec))
(cond
((member type '("pixel" "px" "pix"))
- (setq retval (* num (/ pix-width mm-width) (/ 25.4 72.0))))
+ (setq retval (* num (/ mm-width pix-width) (/ 72.0 25.4))))
((member type '("point" "pt"))
(setq retval num))
((member type '("pica" "pa"))
--
“I, for instance, am gung-ho about open source because my family is being
held hostage in Rob Malda’s basement. But who fact-checks me, or Enderle,
when we say something in public? No-one!” -- Danny O’Brien
[View Less]
[AC21.5R21.4] Stop geometry thrashing in tabs widget
19 years, 4 months
Stephen J. Turnbull
APPROVE COMMIT 21.5 RECOMMEND 21.4
Vin: applies with offset +5 and fuzz 1 on hunk 3. Not yet tested in 21.4.
If you put a printf in xlwtabs.c (TabsGeometryManager) immediately
_after_ the test for "position changed or not resizable" at the top of
the function, you should see that without the patch the printf spews
output on every window, frame, or buffer change; with the patch, you
should _never_ see it.
It turns out that the tabs widget has two parts: the row of tabs, and
the children that …
[View More]it controls. In XEmacs, the children are irrelevant
and never displayed; they're only used for their label/name
resources. (What a waste, but never mind....) So there's no point in
doing any geometry negotiation with them ever.
The existing code attempts to set the XtNresizable resource to NULL,
but does so on the _parent_ widget which doesn't actually have such a
resource, not on the individual children. This patch fixes that.
Index: lwlib/ChangeLog
===================================================================
RCS file: /Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/lwlib/ChangeLog,v
retrieving revision 1.65
diff -u -r1.65 ChangeLog
--- lwlib/ChangeLog 18 Feb 2005 06:29:19 -0000 1.65
+++ lwlib/ChangeLog 8 Mar 2005 15:06:21 -0000
@@ -0,0 +1,6 @@
+2005-03-07 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * lwlib-Xlw.c (build_tabs_in_widget): Correctly disable geometry
+ negotiation for tab children.
+ (xlw_create_tab_control): Don't set nonexistent resizable resource.
+
Index: lwlib/lwlib-Xlw.c
===================================================================
RCS file: /Users/steve/Software/Repositories/cvs.xemacs.org/XEmacs/xemacs/lwlib/lwlib-Xlw.c,v
retrieving revision 1.13
diff -u -r1.13 lwlib-Xlw.c
--- lwlib/lwlib-Xlw.c 20 Sep 2004 19:19:16 -0000 1.13
+++ lwlib/lwlib-Xlw.c 9 Mar 2005 01:00:58 -0000
@@ -319,13 +319,21 @@
#ifdef LWLIB_TABS_LUCID
/* tab control
- lwlib is such an incredible hairy crock. I just cannot believe
+ [[ lwlib is such an incredible hairy crock. I just cannot believe
it! There are random dependencies between functions, there is a
total lack of genericity, even though it initially appears to be
generic. It should all be junked and begun again. Building tabs are
an example - in theory we should be able to reuse a lot of the
general stuff because we want to put labels of whatever toolkit we
- are using in the tab. Instead we have to hack it by hand. */
+ are using in the tab. Instead we have to hack it by hand. ]]
+ While lwlib is a hairy crock, whoever wrote that seems to misunderstand
+ Falk's tab control widget. The tab control widget has *two* kinds of
+ children: *widgets*, which all occupy a *single* pane below the row of
+ tabs---this is where the labels created in build_tabs_in_widget go, and
+ *gadgets*, the tabs themselves, which do *not* draw themselves, but
+ rather are drawn by the control. In fact, in XEmacs the true widget
+ children are *never* visible! So this case is not a problem in the
+ design of lwlib, but rather of Falk's widget. -- sjt */
static void
xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data)
{
@@ -375,9 +383,8 @@
widget_value* val = instance->info->val;
XtSetArg (al [ac], XtNsensitive, val->enabled); ac++;
- XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
+ XtSetArg (al [ac], XtNmappedWhenManaged, False); ac++;
XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++;
- XtSetArg (al [ac], XtNresizable, False); ac++;
/* add any args the user supplied for creation time */
lw_add_value_args_to_args (val, al, &ac);
@@ -396,15 +403,22 @@
Widget widget, widget_value* val)
{
widget_value* cur = val;
+ Arg al[1];
+
+ /* Children are always invisible, don't permit resizing. */
+ XtSetArg (al[0], XtNresizable, False);
+
for (cur = val; cur; cur = cur->next)
{
if (cur->value)
{
+ Widget w;
#ifdef LWLIB_WIDGETS_MOTIF
- xm_create_label (widget, cur);
+ w = xm_create_label (widget, cur);
#else
- xaw_create_label (widget, cur);
+ w = xaw_create_label (widget, cur);
#endif
+ XtSetValues (w, al, 1);
}
cur->change = NO_CHANGE;
}
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
[View Less]
[R21.4] document CCL example
19 years, 4 months
Stephen J. Turnbull
RECOMMEND 21.4
Vin: this is actually work by Aidan that I found on the floor. I'm
sure Aidan recommends it, too. :-) This patch is against 21.4.
Index: man/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/man/ChangeLog,v
retrieving revision 1.290
diff -u -U0 -r1.290 ChangeLog
--- man/ChangeLog 23 Feb 2005 15:33:32 -0000 1.290
+++ man/ChangeLog 9 Mar 2005 05:16:46 -0000
@@ -0,0 +1,5 @@
+2005-01-19 Aidan Kehoe <kehoea(…
[View More]a)parhasard.net>
+
+ * lispref/mule.texi (CCL Example): Detail an implementation of the
+ web's URL encoding as a CCL coding system example.
+
Index: man/lispref/mule.texi
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/man/lispref/mule.texi,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 mule.texi
--- man/lispref/mule.texi 20 Aug 2002 11:35:49 -0000 1.4.2.2
+++ man/lispref/mule.texi 9 Mar 2005 05:42:38 -0000
@@ -1723,7 +1723,7 @@
* CCL Statements:: Semantics of CCL statements.
* CCL Expressions:: Operators and expressions in CCL.
* Calling CCL:: Running CCL programs.
-* CCL Examples:: The encoding functions for Big5 and KOI-8.
+* CCL Example:: A trivial program to transform the Web's URL encoding.
@end menu
@node CCL Syntax, CCL Statements, , CCL
@@ -1942,7 +1942,7 @@
Shift JIS. CCL_DECODE_SJIS is its inverse.) It is somewhat odd to
represent the SJIS operations in infix form.
-@node Calling CCL, CCL Examples, CCL Expressions, CCL
+@node Calling CCL, CCL Example, CCL Expressions, CCL
@comment Node, Next, Previous, Up
@subsection Calling CCL
@@ -2008,11 +2008,277 @@
Resets the CCL interpreter's internal elapsed time registers.
@end defun
-@node CCL Examples, , Calling CCL, CCL
+@node CCL Example, , Calling CCL, CCL
@comment Node, Next, Previous, Up
-@subsection CCL Examples
+@subsection CCL Example
- This section is not yet written.
+ In this section, we describe the implementation of a trivial coding
+system to transform from the Web's URL encoding to XEmacs' internal
+coding. Many people will have been first exposed to URL encoding when
+they saw ``%20'' where they expected a space in a file's name on their
+local hard disk; this can happen when a browser saves a file from the
+web and doesn't encode the name, as passed from the server, properly.
+
+ URL encoding itself is underspecified with regard to encodings beyond
+ASCII. The relevant document, RFC 1738, explicitly doesn't give any
+information on how to encode non-ASCII characters, and the ``obvious''
+way---use the %xx values for the octets of the eight bit MIME character
+set in which the page was served---breaks when a user types a character
+outside that character set. Best practice for web development is to
+serve all pages as UTF-8 and treat incoming form data as using that
+coding system. (Oh, and gamble that your clients won't ever want to
+type anything outside Unicode. But that's not so much of a gamble with
+today's client operating systems.) We don't treat non-ASCII in this
+example, as dealing with @samp{(read-multibyte-character ...)} and
+errors therewith would make it much harder to understand.
+
+ Since CCL isn't a very rich language, we move much of the logic that
+would ordinarily be computed from operations like @code{(member ..)},
+@code{(and ...)} and @code{(or ...)} into tables, from which register
+values are read and written, and on which @code{if} statements are
+predicated. Much more of the implementation of this coding system is
+occupied with constructing these tables---in normal Emacs Lisp---than it
+is with actual CCL code.
+
+ All the @code{defvar} statements we deal with in the next few sections
+are surrounded by a @code{(eval-and-compile ...)}, which means that the
+logic which initializes these variables executes at compile time, and if
+XEmacs loads the compiled version of the file, these variables are
+initialized as constants.
+
+@menu
+* Four bits to ASCII:: Two tables used for getting hex digits from ASCII.
+* URI Encoding constants:: Useful predefined characters.
+* Numeric to ASCII-hexadecimal conversion:: Trivial in Lisp, not so in CCL.
+* Characters to be preserved:: No transformation needed for these characters.
+* The program to decode to internal format:: .
+* The program to encode from internal format:: .
+
+@end menu
+
+@node Four bits to ASCII, URI Encoding constants, , CCL Example
+@subsubsection Four bits to ASCII
+
+ The first @code{defvar} is for
+@code{url-coding-high-order-nybble-as-ascii}, a 256-entry table that
+maps from an octet's value to the ASCII encoding for the hex value of
+its most significant four bits. That might sound complex, but it isn't;
+for decimal 65, hex value @samp{#x41}, the entry in the table is the
+ASCII encoding of `4'. For decimal 122, ASCII `z', hex value
+@code{#x7a}, @code{(elt url-coding-high-order-nybble-as-ascii #x7a)}
+after this file is loaded gives the ASCII encoding of 7.
+
+@example
+(defvar url-coding-high-order-nybble-as-ascii
+ (let ((val (make-vector 256 0))
+ (i 0))
+ (while (< i (length val))
+ (aset val i (char-int (aref (format "%02X" i) 0)))
+ (setq i (1+ i)))
+ val)
+ "Table to find an ASCII version of an octet's most significant 4 bits.")
+@end example
+
+ The next table, @code{url-coding-low-order-nybble-as-ascii} is almost
+the same thing, but this time it has a map for the hex encoding of the
+low-order four bits. So the sixty-fifth entry (offset @samp{#x51}) is
+the ASCII encoding of `1', the hundred-and-twenty-second (offset
+@samp{#x7a}) is the ASCII encoding of `A'.
+
+@example
+(defvar url-coding-low-order-nybble-as-ascii
+ (let ((val (make-vector 256 0))
+ (i 0))
+ (while (< i (length val))
+ (aset val i (char-int (aref (format "%02X" i) 1)))
+ (setq i (1+ i)))
+ val)
+ "Table to find an ASCII version of an octet's least significant 4 bits.")
+@end example
+
+@node URI Encoding constants, Numeric to ASCII-hexadecimal conversion, Four bits to ASCII, CCL Example
+@subsubsection URI Encoding constants
+
+ Next, we have a couple of variables that make the CCL code more
+readable. The first is the ASCII encoding of the percentage sign; this
+character is used as an escape code, to start the encoding of a
+non-printable character. For historical reasons, URL encoding allows
+the space character to be encoded as a plus sign--it does make typing
+URLs like @samp{http://google.com/search?q=XEmacs+home+page} easier--and
+as such, we have to check when decoding for this value, and map it to
+the space character. When doing this in CCL, we use the
+@code{url-coding-escaped-space-code} variable.
+
+@example
+(defvar url-coding-escape-character-code (char-int ?%)
+ "The code point for the percentage sign, in ASCII.")
+
+(defvar url-coding-escaped-space-code (char-int ?+)
+ "The URL-encoded value of the space character, that is, +.")
+@end example
+
+@node Numeric to ASCII-hexadecimal conversion
+@subsubsection Numeric to ASCII-hexadecimal conversion
+
+ Now, we have a couple of utility tables that wouldn't be necessary in
+a more expressive programming language than is CCL. The first is sixteen
+in length, and maps a hexadecimal number to the ASCII encoding of that
+number; so zero maps to ASCII `0', ten maps to ASCII `A.' The second
+does the reverse; that is, it maps an ASCII character to its value when
+interpreted as a hexadecimal digit. ('A' => 10, 'c' => 12, '2' => 2, as
+a few examples.)
+
+@example
+(defvar url-coding-hex-digit-table
+ (let ((i 0)
+ (val (make-vector 16 0)))
+ (while (< i 16)
+ (aset val i (char-int (aref (format "%X" i) 0)))
+ (setq i (1+ i)))
+ val)
+ "A map from a hexadecimal digit's numeric value to its encoding in ASCII.")
+
+(defvar url-coding-latin-1-as-hex-table
+ (let ((val (make-vector 256 0))
+ (i 0))
+ (while (< i (length val))
+ ;; Get a hex val for this ASCII character.
+ (aset val i (string-to-int (format "%c" i) 16))
+ (setq i (1+ i)))
+ val)
+ "A map from Latin 1 code points to their values as hexadecimal digits.")
+@end example
+
+@node Characters to be preserved
+@subsubsection Characters to be preserved
+
+ And finally, the last of these tables. URL encoding says that
+alphanumeric characters, the underscore, hyphen and the full stop
+@footnote{That's what the standards call it, though my North American
+readers will be more familiar with it as the period character.} retain
+their ASCII encoding, and don't undergo transformation.
+@code{url-coding-should-preserve-table} is an array in which the entries
+are one if the corresponding ASCII character should be left as-is, and
+zero if they should be transformed. So the entries for all the control
+and most of the punctuation charcters are zero. Lisp programmers will
+observe that this initialization is particularly inefficient, but
+they'll also be aware that this is a long way from an inner loop where
+every nanosecond counts.
+
+@example
+(defvar url-coding-should-preserve-table
+ (let ((preserve
+ (list ?- ?_ ?. ?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o
+ ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z ?A ?B ?C ?D ?E ?F ?G
+ ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y
+ ?Z ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
+ (i 0)
+ (res (make-vector 256 0)))
+ (while (< i 256)
+ (when (member (int-char i) preserve)
+ (aset res i 1))
+ (setq i (1+ i)))
+ res)
+ "A 256-entry array of flags, indicating whether or not to preserve an
+octet as its ASCII encoding.")
+@end example
+
+@node The program to decode to internal format
+@subsubsection The program to decode to internal format
+
+ After the almost interminable tables, we get to the CCL. The first
+CCL program, @code{ccl-decode-urlcoding} decodes from the URL coding to
+our internal format; since this version of CCL doesn't have support for
+error checking on the input, we don't do any verification on it.
+
+The buffer magnification--approximate ratio of the size of the output
+buffer to the size of the input buffer--is declared as one, because
+fractional values aren't allowed. (Since all those %20's will map to
+` ', the length of the output text will be less than that of the input
+text.)
+
+So, first we read an octet from the input buffer into register
+@samp{r0}, to set up the loop. Next, we start the loop, with a
+@code{(loop ...)} statement, and we check if the value in @samp{r0} is a
+percentage sign. (Note the comma before
+@code{url-coding-escape-character-code}; since CCL is a Lisp macro
+language, we can break out of the macro evaluation with a comman, and as
+such, ``@code{,url-coding-escape-character-code}'' will be evaluated as a
+literal `37.')
+
+If it is a percentage sign, we read the next two octets into @samp{r2}
+and @samp{r3}, and convert them into their hexadecimal numeric values,
+using the @code{url-coding-latin-1-as-hex-table} array declared above.
+(But again, it'll be interpreted as a literal array.) We then left
+shift the first by four bits, mask the two together, and write the
+result to the output buffer.
+
+If it isn't a percentage sign, and it is a `+' sign, we write a
+space--hexadecimal 20--to the output buffer.
+
+If none of those things are true, we pass the octet to the output buffer
+untransformed. (This could be a place to put error checking, in a more
+expressive language.) We then read one more octet from the input
+buffer, and move to the next iteration of the loop.
+
+@example
+(define-ccl-program ccl-decode-urlcoding
+ `(1
+ ((read r0)
+ (loop
+ (if (r0 == ,url-coding-escape-character-code)
+ ((read r2 r3)
+ ;; Assign the value at offset r2 in the url-coding-hex-digit-table
+ ;; to r3.
+ (r2 = r2 ,url-coding-latin-1-as-hex-table)
+ (r3 = r3 ,url-coding-latin-1-as-hex-table)
+ (r2 <<= 4)
+ (r3 |= r2)
+ (write r3))
+ (if (r0 == ,url-coding-escaped-space-code)
+ (write #x20)
+ (write r0)))
+ (read r0)
+ (repeat))))
+ "CCL program to take URI-encoded ASCII text and transform it to our
+internal encoding. ")
+@end example
+
+@node The program to encode from internal format
+@subsubsection The program to encode from internal format
+
+ Next, we see the CCL program to encode ASCII text as URL coded text.
+Here, the buffer magnification is specified as three, to account for ` '
+mapping to %20, etc. As before, we read an octet from the input into
+@samp{r0}, and move into the body of the loop. Next, we check if we
+should preserve the value of this octet, by reading from offset
+@samp{r0} in the @code{url-coding-should-preserve-table} into @samp{r1}.
+Then we have an @samp{if} statement predicated on the value in
+@samp{r1}; for the true branch, we write the input octet directly. For
+the false branch, we write a percentage sign, the ASCII encoding of the
+high four bits in hex, and then the ASCII encoding of the low four bits
+in hex.
+
+We then read an octet from the input into @samp{r0}, and repeat the loop.
+
+@example
+(define-ccl-program ccl-encode-urlcoding
+ `(3
+ ((read r0)
+ (loop
+ (r1 = r0 ,url-coding-should-preserve-table)
+ ;; If we should preserve the value, just write the octet directly.
+ (if r1
+ (write r0)
+ ;; else, write a percentage sign, and the hex value of the octet, in
+ ;; an ASCII-friendly format.
+ ((write ,url-coding-escape-character-code)
+ (write r0 ,url-coding-high-order-nybble-as-ascii)
+ (write r0 ,url-coding-low-order-nybble-as-ascii)))
+ (read r0)
+ (repeat))))
+ "CCL program to encode octets (almost) according to RFC 1738")
+@end example
@node Category Tables, , CCL, MULE
@section Category Tables
--
Institute of Policy and Planning Sciences http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.
[View Less]
[AC21.4R21.5] Email truncation bug begone!
19 years, 6 months
Jerry James
APPROVE COMMIT 21.5 RECOMMEND 21.4
David,
I took much too long to process this. I can only claim extreme busyness
with some Real Life stuff over the last several weeks. Thank you so
much for analyzing the problem and coming up with a fix. I'm going to
give credit where credit is due (although I did tweak your patch very
slightly in a couple of ways). The 21.5 patch, which I am committing,
is first, followed by the 21.4 version of the patch. Both have the same
ChangeLog entry.
See the …
[View More]discussion rooted here for more information:
http://list-archive.xemacs.org/xemacs-beta/200412/msg00128.html
src/ChangeLog addition:
2005-02-03 David Evers <extsw(a)appliedgenerics.com>
* process-unix.c (unix_send_process): Flush the last chunk, even
when the pipe is blocked.
xemacs-21.5 source patch:
Diff command: cvs -q diff -uN
Files affected: src/process-unix.c
Index: src/process-unix.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/process-unix.c,v
retrieving revision 1.56
diff -d -u -r1.56 process-unix.c
--- src/process-unix.c 2005/01/24 23:34:05 1.56
+++ src/process-unix.c 2005/02/04 03:53:40
@@ -1511,30 +1511,38 @@
Ibyte chunkbuf[512];
Bytecount chunklen;
- while (1)
+ do
{
int writeret;
chunklen = Lstream_read (lstream, chunkbuf, 512);
- if (chunklen <= 0)
- break; /* perhaps should ABORT() if < 0?
- This should never happen. */
old_sigpipe =
(SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, send_process_trap);
- /* Lstream_write() will never successfully write less than
- the amount sent in. In the worst case, it just buffers
- the unwritten data. */
- writeret = Lstream_write (XLSTREAM (DATA_OUTSTREAM (p)), chunkbuf,
- chunklen);
- {
- int save_errno = errno;
- EMACS_SIGNAL (SIGPIPE, old_sigpipe);
- errno = save_errno;
- if (writeret < 0)
- /* This is a real error. Blocking errors are handled
- specially inside of the filedesc stream. */
- report_process_error ("writing to process", proc);
- }
+ if (chunklen > 0)
+ {
+ int save_errno;
+
+ /* Lstream_write() will never successfully write less than
+ the amount sent in. In the worst case, it just buffers
+ the unwritten data. */
+ writeret = Lstream_write (XLSTREAM (DATA_OUTSTREAM(p)), chunkbuf,
+ chunklen);
+ save_errno = errno;
+ EMACS_SIGNAL (SIGPIPE, old_sigpipe);
+ errno = save_errno;
+ if (writeret < 0)
+ /* This is a real error. Blocking errors are handled
+ specially inside of the filedesc stream. */
+ report_file_error ("writing to process", list1 (proc));
+ }
+ else
+ {
+ /* Need to make sure that everything up to and including the
+ last chunk is flushed, even when the pipe is currently
+ blocked. */
+ Lstream_flush (XLSTREAM (DATA_OUTSTREAM(p)));
+ EMACS_SIGNAL (SIGPIPE, old_sigpipe);
+ }
while (Lstream_was_blocked_p (XLSTREAM (p->pipe_outstream)))
{
/* Buffer is full. Wait, accepting input;
@@ -1549,7 +1557,9 @@
Lstream_flush (XLSTREAM (p->pipe_outstream));
EMACS_SIGNAL (SIGPIPE, old_sigpipe);
}
+ /* Perhaps should ABORT() if < 0? This should never happen. */
}
+ while (chunklen > 0);
}
else
{ /* We got here from a longjmp() from the SIGPIPE handler */
Index: src/process-unix.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/process-unix.c,v
retrieving revision 1.20.2.8
diff -d -u -r1.20.2.8 process-unix.c
--- src/process-unix.c 2005/01/31 02:55:26 1.20.2.8
+++ src/process-unix.c 2005/02/04 03:31:08
@@ -1293,26 +1293,38 @@
Bufbyte chunkbuf[512];
Bytecount chunklen;
- while (1)
+ do
{
Lstream_data_count writeret;
chunklen = Lstream_read (lstream, chunkbuf, 512);
- if (chunklen <= 0)
- break; /* perhaps should ABORT() if < 0?
- This should never happen. */
old_sigpipe =
(SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap);
- /* Lstream_write() will never successfully write less than
- the amount sent in. In the worst case, it just buffers
- the unwritten data. */
- writeret = Lstream_write (XLSTREAM (DATA_OUTSTREAM(p)), chunkbuf,
- chunklen);
- signal (SIGPIPE, old_sigpipe);
- if (writeret < 0)
- /* This is a real error. Blocking errors are handled
- specially inside of the filedesc stream. */
- report_file_error ("writing to process", list1 (proc));
+ if (chunklen > 0)
+ {
+ int save_errno;
+
+ /* Lstream_write() will never successfully write less than
+ the amount sent in. In the worst case, it just buffers
+ the unwritten data. */
+ writeret = Lstream_write (XLSTREAM (DATA_OUTSTREAM(p)), chunkbuf,
+ chunklen);
+ save_errno = errno;
+ signal (SIGPIPE, old_sigpipe);
+ errno = save_errno;
+ if (writeret < 0)
+ /* This is a real error. Blocking errors are handled
+ specially inside of the filedesc stream. */
+ report_file_error ("writing to process", list1 (proc));
+ }
+ else
+ {
+ /* Need to make sure that everything up to and including the
+ last chunk is flushed, even when the pipe is currently
+ blocked. */
+ Lstream_flush (XLSTREAM (DATA_OUTSTREAM(p)));
+ signal (SIGPIPE, old_sigpipe);
+ }
while (Lstream_was_blocked_p (XLSTREAM (p->pipe_outstream)))
{
/* Buffer is full. Wait, accepting input;
@@ -1327,7 +1339,9 @@
Lstream_flush (XLSTREAM (p->pipe_outstream));
signal (SIGPIPE, old_sigpipe);
}
+ /* Perhaps should abort() if < 0? This should never happen. */
}
+ while (chunklen > 0);
}
else
{ /* We got here from a longjmp() from the SIGPIPE handler */
--
Jerry James
http://www.ittc.ku.edu/~james/
[View Less]