Mercurial > hg > xemacs-beta
comparison src/ChangeLog @ 734:8bd30fae1bce
[xemacs-hg @ 2002-01-25 16:46:24 by stephent]
Per patch <87665q9yfh.fsf@tleepslib.sk.tsukuba.ac.jp>.
author | stephent |
---|---|
date | Fri, 25 Jan 2002 16:46:26 +0000 |
parents | b1f74adcc1ff |
children | 2e5e2ccbeed2 |
comparison
equal
deleted
inserted
replaced
733:b1f74adcc1ff | 734:8bd30fae1bce |
---|---|
1 2002-01-26 Stephen J. Turnbull <stephen@xemacs.org> | |
2 | |
3 * ChangeLog (2001-09-19 Ben Wing): Entry dosed with Dramamine. | |
4 * README.integral-types: New file excised from ChangeLog. | |
5 | |
1 2002-01-19 Jan Vroonhof <jan@xemacs.org> | 6 2002-01-19 Jan Vroonhof <jan@xemacs.org> |
2 | 7 |
3 * cmdloop.c: New variable Qdisabled_command_loop. | 8 * cmdloop.c: New variable Qdisabled_command_loop. |
4 Move Vdisabled_command_loop declaration here. | 9 Move Vdisabled_command_loop declaration here. |
5 * cmdloop.c (syms_of_cmdloop): Declare Qdisabled_command_loop. | 10 * cmdloop.c (syms_of_cmdloop): Declare Qdisabled_command_loop. |
1178 * window.c (Fcurrent_pixel_column): | 1183 * window.c (Fcurrent_pixel_column): |
1179 * window.h (struct window): | 1184 * window.h (struct window): |
1180 | 1185 |
1181 The great integral types renaming. | 1186 The great integral types renaming. |
1182 | 1187 |
1183 The purpose of this is to rationalize the names used for various | 1188 Rationalize the names used for various integral types, so that |
1184 integral types, so that they match their intended uses and follow | 1189 they match their intended uses and follow consist conventions, and |
1185 consist conventions, and eliminate types that were not semantically | 1190 eliminate types that were not semantically different from each |
1186 different from each other. | 1191 other. The following global substitutions were made: |
1187 | 1192 |
1188 The conventions are: | 1193 Memory_Count Bytecount |
1189 | 1194 Lstream_Data_Count Bytecount |
1190 -- All integral types that measure quantities of anything are | 1195 Element_Count Elemcount |
1191 signed. Some people disagree vociferously with this, but their | 1196 Hash_Code Hashcode |
1192 arguments are mostly theoretical, and are vastly outweighed by | 1197 extcount bytecount |
1193 the practical headaches of mixing signed and unsigned values, | 1198 bufpos charbpos |
1194 and more importantly by the far increased likelihood of | 1199 bytind bytebpos |
1195 inadvertent bugs: Because of the broken "viral" nature of | 1200 memind membpos |
1196 unsigned quantities in C (operations involving mixed | 1201 bufbyte intbyte |
1197 signed/unsigned are done unsigned, when exactly the opposite is | 1202 Extcount Bytecount |
1198 nearly always wanted), even a single error in declaring a | 1203 Bufpos Charbpos |
1199 quantity unsigned that should be signed, or even the even more | 1204 Bytind Bytebpos |
1200 subtle error of comparing signed and unsigned values and | 1205 Memind Membpos |
1201 forgetting the necessary cast, can be catastrophic, as | 1206 Bufbyte Intbyte |
1202 comparisons will yield wrong results. -Wsign-compare is turned | 1207 EXTCOUNT BYTECOUNT |
1203 on specifically to catch this, but this tends to result in a | 1208 BUFPOS CHARBPOS |
1204 great number of warnings when mixing signed and unsigned, and | 1209 BYTIND BYTEBPOS |
1205 the casts are annoying. More has been written on this | 1210 MEMIND MEMBPOS |
1206 elsewhere. | 1211 BUFBYTE INTBYTE |
1207 | 1212 MEMORY_COUNT BYTECOUNT |
1208 -- All such quantity types just mentioned boil down to EMACS_INT, | 1213 LSTREAM_DATA_COUNT BYTECOUNT |
1209 which is 32 bits on 32-bit machines and 64 bits on 64-bit | 1214 ELEMENT_COUNT ELEMCOUNT |
1210 machines. This is guaranteed to be the same size as Lisp | 1215 HASH_CODE HASHCODE |
1211 objects of type `int', and (as far as I can tell) of size_t | 1216 |
1212 (unsigned!) and ssize_t. The only type below that is not an | 1217 This resulted in some duplications. |
1213 EMACS_INT is Hashcode, which is an unsigned value of the same | 1218 |
1214 size as EMACS_INT. | 1219 * lisp.h: removed duplicate declarations of Bytecount. |
1215 | 1220 |
1216 -- Type names should be relatively short (no more than 10 | 1221 * lstream.h: removed duplicate declaration of Bytecount. |
1217 characters or so), with the first letter capitalized and no | 1222 Rewrote the comment about this type. |
1218 underscores if they can at all be avoided. | 1223 |
1219 | 1224 * dumper.c: remove duplicate case tag XD_BYTECOUNT, and the |
1220 -- "count" == a zero-based measurement of some quantity. Includes | 1225 accompanying duplicate code, from 4 switchs tatements. |
1221 sizes, offsets, and indexes. | 1226 |
1222 | 1227 See README.integral-types in this directory for more details. |
1223 -- "bpos" == a one-based measurement of a position in a buffer. | |
1224 "Charbpos" and "Bytebpos" count text in the buffer, rather than | |
1225 bytes in memory; thus Bytebpos does not directly correspond to | |
1226 the memory representation. Use "Membpos" for this. | |
1227 | |
1228 -- "Char" refers to internal-format characters, not to the C type | |
1229 "char", which is really a byte. | |
1230 | |
1231 -- For the actual name changes, see the script below. | |
1232 | |
1233 I ran the following script to do the conversion. (NOTE: This script | |
1234 is idempotent. You can safely run it multiple times and it will | |
1235 not screw up previous results -- in fact, it will do nothing if | |
1236 nothing has changed. Thus, it can be run repeatedly as necessary | |
1237 to handle patches coming in from old workspaces, or old branches.) | |
1238 There are two tags, just before and just after the change: | |
1239 `pre-integral-type-rename' and `post-integral-type-rename'. When | |
1240 merging code from the main trunk into a branch, the best thing to | |
1241 do is first merge up to `pre-integral-type-rename', then apply the | |
1242 script and associated changes, then merge from | |
1243 `post-integral-type-change' to the present. (Alternatively, just do | |
1244 the merging in one operation; but you may then have a lot of | |
1245 conflicts needing to be resolved by hand.) | |
1246 | |
1247 Script `fixtypes.sh' follows: | |
1248 | |
1249 | |
1250 ----------------------------------- cut ------------------------------------ | |
1251 files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]" | |
1252 gr Memory_Count Bytecount $files | |
1253 gr Lstream_Data_Count Bytecount $files | |
1254 gr Element_Count Elemcount $files | |
1255 gr Hash_Code Hashcode $files | |
1256 gr extcount bytecount $files | |
1257 gr bufpos charbpos $files | |
1258 gr bytind bytebpos $files | |
1259 gr memind membpos $files | |
1260 gr bufbyte intbyte $files | |
1261 gr Extcount Bytecount $files | |
1262 gr Bufpos Charbpos $files | |
1263 gr Bytind Bytebpos $files | |
1264 gr Memind Membpos $files | |
1265 gr Bufbyte Intbyte $files | |
1266 gr EXTCOUNT BYTECOUNT $files | |
1267 gr BUFPOS CHARBPOS $files | |
1268 gr BYTIND BYTEBPOS $files | |
1269 gr MEMIND MEMBPOS $files | |
1270 gr BUFBYTE INTBYTE $files | |
1271 gr MEMORY_COUNT BYTECOUNT $files | |
1272 gr LSTREAM_DATA_COUNT BYTECOUNT $files | |
1273 gr ELEMENT_COUNT ELEMCOUNT $files | |
1274 gr HASH_CODE HASHCODE $files | |
1275 ----------------------------------- cut ------------------------------------ | |
1276 | |
1277 | |
1278 `fixtypes.sh' is a Bourne-shell script; it uses 'gr': | |
1279 | |
1280 | |
1281 ----------------------------------- cut ------------------------------------ | |
1282 #!/bin/sh | |
1283 | |
1284 # Usage is like this: | |
1285 | |
1286 # gr FROM TO FILES ... | |
1287 | |
1288 # globally replace FROM with TO in FILES. FROM and TO are regular expressions. | |
1289 # backup files are stored in the `backup' directory. | |
1290 from="$1" | |
1291 to="$2" | |
1292 shift 2 | |
1293 echo ${1+"$@"} | xargs global-replace "s/$from/$to/g" | |
1294 ----------------------------------- cut ------------------------------------ | |
1295 | |
1296 | |
1297 `gr' in turn uses a Perl script to do its real work, | |
1298 `global-replace', which follows: | |
1299 | |
1300 | |
1301 ----------------------------------- cut ------------------------------------ | |
1302 : #-*- Perl -*- | |
1303 | |
1304 ### global-modify --- modify the contents of a file by a Perl expression | |
1305 | |
1306 ## Copyright (C) 1999 Martin Buchholz. | |
1307 ## Copyright (C) 2001 Ben Wing. | |
1308 | |
1309 ## Authors: Martin Buchholz <martin@xemacs.org>, Ben Wing <ben@xemacs.org> | |
1310 ## Maintainer: Ben Wing <ben@xemacs.org> | |
1311 ## Current Version: 1.0, May 5, 2001 | |
1312 | |
1313 # This program is free software; you can redistribute it and/or modify | |
1314 # it under the terms of the GNU General Public License as published by | |
1315 # the Free Software Foundation; either version 2, or (at your option) | |
1316 # any later version. | |
1317 # | |
1318 # This program is distributed in the hope that it will be useful, but | |
1319 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
1320 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1321 # General Public License for more details. | |
1322 # | |
1323 # You should have received a copy of the GNU General Public License | |
1324 # along with XEmacs; see the file COPYING. If not, write to the Free | |
1325 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
1326 # 02111-1307, USA. | |
1327 | |
1328 eval 'exec perl -w -S $0 ${1+"$@"}' | |
1329 if 0; | |
1330 | |
1331 use strict; | |
1332 use FileHandle; | |
1333 use Carp; | |
1334 use Getopt::Long; | |
1335 use File::Basename; | |
1336 | |
1337 (my $myName = $0) =~ s@.*/@@; my $usage=" | |
1338 Usage: $myName [--help] [--backup-dir=DIR] [--line-mode] [--hunk-mode] | |
1339 PERLEXPR FILE ... | |
1340 | |
1341 Globally modify a file, either line by line or in one big hunk. | |
1342 | |
1343 Typical usage is like this: | |
1344 | |
1345 [with GNU print, GNU xargs: guaranteed to handle spaces, quotes, etc. | |
1346 in file names] | |
1347 | |
1348 find . -name '*.[ch]' -print0 | xargs -0 $0 's/\bCONST\b/const/g'\n | |
1349 | |
1350 [with non-GNU print, xargs] | |
1351 | |
1352 find . -name '*.[ch]' -print | xargs $0 's/\bCONST\b/const/g'\n | |
1353 | |
1354 | |
1355 The file is read in, either line by line (with --line-mode specified) | |
1356 or in one big hunk (with --hunk-mode specified; it's the default), and | |
1357 the Perl expression is then evalled with \$_ set to the line or hunk of | |
1358 text, including the terminating newline if there is one. It should | |
1359 destructively modify the value there, storing the changed result in \$_. | |
1360 | |
1361 Files in which any modifications are made are backed up to the directory | |
1362 specified using --backup-dir, or to `backup' by default. To disable this, | |
1363 use --backup-dir= with no argument. | |
1364 | |
1365 Hunk mode is the default because it is MUCH MUCH faster than line-by-line. | |
1366 Use line-by-line only when it matters, e.g. you want to do a replacement | |
1367 only once per line (the default without the `g' argument). Conversely, | |
1368 when using hunk mode, *ALWAYS* use `g'; otherwise, you will only make one | |
1369 replacement in the entire file! | |
1370 "; | |
1371 | |
1372 my %options = (); | |
1373 $Getopt::Long::ignorecase = 0; | |
1374 &GetOptions ( | |
1375 \%options, | |
1376 'help', 'backup-dir=s', 'line-mode', 'hunk-mode', | |
1377 ); | |
1378 | |
1379 | |
1380 die $usage if $options{"help"} or @ARGV <= 1; | |
1381 my $code = shift; | |
1382 | |
1383 die $usage if grep (-d || ! -w, @ARGV); | |
1384 | |
1385 sub SafeOpen { | |
1386 open ((my $fh = new FileHandle), $_[0]); | |
1387 confess "Can't open $_[0]: $!" if ! defined $fh; | |
1388 return $fh; | |
1389 } | |
1390 | |
1391 sub SafeClose { | |
1392 close $_[0] or confess "Can't close $_[0]: $!"; | |
1393 } | |
1394 | |
1395 sub FileContents { | |
1396 my $fh = SafeOpen ("< $_[0]"); | |
1397 my $olddollarslash = $/; | |
1398 local $/ = undef; | |
1399 my $contents = <$fh>; | |
1400 $/ = $olddollarslash; | |
1401 return $contents; | |
1402 } | |
1403 | |
1404 sub WriteStringToFile { | |
1405 my $fh = SafeOpen ("> $_[0]"); | |
1406 binmode $fh; | |
1407 print $fh $_[1] or confess "$_[0]: $!\n"; | |
1408 SafeClose $fh; | |
1409 } | |
1410 | |
1411 foreach my $file (@ARGV) { | |
1412 my $changed_p = 0; | |
1413 my $new_contents = ""; | |
1414 if ($options{"line-mode"}) { | |
1415 my $fh = SafeOpen $file; | |
1416 while (<$fh>) { | |
1417 my $save_line = $_; | |
1418 eval $code; | |
1419 $changed_p = 1 if $save_line ne $_; | |
1420 $new_contents .= $_; | |
1421 } | |
1422 } else { | |
1423 my $orig_contents = $_ = FileContents $file; | |
1424 eval $code; | |
1425 if ($_ ne $orig_contents) { | |
1426 $changed_p = 1; | |
1427 $new_contents = $_; | |
1428 } | |
1429 } | |
1430 | |
1431 if ($changed_p) { | |
1432 my $backdir = $options{"backup-dir"}; | |
1433 $backdir = "backup" if !defined ($backdir); | |
1434 if ($backdir) { | |
1435 my ($name, $path, $suffix) = fileparse ($file, ""); | |
1436 my $backfulldir = $path . $backdir; | |
1437 my $backfile = "$backfulldir/$name"; | |
1438 mkdir $backfulldir, 0755 unless -d $backfulldir; | |
1439 print "modifying $file (original saved in $backfile)\n"; | |
1440 rename $file, $backfile; | |
1441 } | |
1442 WriteStringToFile ($file, $new_contents); | |
1443 } | |
1444 } | |
1445 ----------------------------------- cut ------------------------------------ | |
1446 | |
1447 | |
1448 In addition to those programs, I needed to fix up a few other | |
1449 things, particularly relating to the duplicate definitions of | |
1450 types, now that some types merged with others. Specifically: | |
1451 | |
1452 1. in lisp.h, removed duplicate declarations of Bytecount. The | |
1453 changed code should now look like this: (In each code snippet | |
1454 below, the first and last lines are the same as the original, as | |
1455 are all lines outside of those lines. That allows you to locate | |
1456 the section to be replaced, and replace the stuff in that | |
1457 section, verifying that there isn't anything new added that | |
1458 would need to be kept.) | |
1459 | |
1460 --------------------------------- snip ------------------------------------- | |
1461 /* Counts of bytes or chars */ | |
1462 typedef EMACS_INT Bytecount; | |
1463 typedef EMACS_INT Charcount; | |
1464 | |
1465 /* Counts of elements */ | |
1466 typedef EMACS_INT Elemcount; | |
1467 | |
1468 /* Hash codes */ | |
1469 typedef unsigned long Hashcode; | |
1470 | |
1471 /* ------------------------ dynamic arrays ------------------- */ | |
1472 --------------------------------- snip ------------------------------------- | |
1473 | |
1474 2. in lstream.h, removed duplicate declaration of Bytecount. | |
1475 Rewrote the comment about this type. The changed code should | |
1476 now look like this: | |
1477 | |
1478 | |
1479 --------------------------------- snip ------------------------------------- | |
1480 #endif | |
1481 | |
1482 /* The have been some arguments over the what the type should be that | |
1483 specifies a count of bytes in a data block to be written out or read in, | |
1484 using Lstream_read(), Lstream_write(), and related functions. | |
1485 Originally it was long, which worked fine; Martin "corrected" these to | |
1486 size_t and ssize_t on the grounds that this is theoretically cleaner and | |
1487 is in keeping with the C standards. Unfortunately, this practice is | |
1488 horribly error-prone due to design flaws in the way that mixed | |
1489 signed/unsigned arithmetic happens. In fact, by doing this change, | |
1490 Martin introduced a subtle but fatal error that caused the operation of | |
1491 sending large mail messages to the SMTP server under Windows to fail. | |
1492 By putting all values back to be signed, avoiding any signed/unsigned | |
1493 mixing, the bug immediately went away. The type then in use was | |
1494 Lstream_Data_Count, so that it be reverted cleanly if a vote came to | |
1495 that. Now it is Bytecount. | |
1496 | |
1497 Some earlier comments about why the type must be signed: This MUST BE | |
1498 SIGNED, since it also is used in functions that return the number of | |
1499 bytes actually read to or written from in an operation, and these | |
1500 functions can return -1 to signal error. | |
1501 | |
1502 Note that the standard Unix read() and write() functions define the | |
1503 count going in as a size_t, which is UNSIGNED, and the count going | |
1504 out as an ssize_t, which is SIGNED. This is a horrible design | |
1505 flaw. Not only is it highly likely to lead to logic errors when a | |
1506 -1 gets interpreted as a large positive number, but operations are | |
1507 bound to fail in all sorts of horrible ways when a number in the | |
1508 upper-half of the size_t range is passed in -- this number is | |
1509 unrepresentable as an ssize_t, so code that checks to see how many | |
1510 bytes are actually written (which is mandatory if you are dealing | |
1511 with certain types of devices) will get completely screwed up. | |
1512 | |
1513 --ben | |
1514 */ | |
1515 | |
1516 typedef enum lstream_buffering | |
1517 --------------------------------- snip ------------------------------------- | |
1518 | |
1519 | |
1520 3. in dumper.c, there are four places, all inside of switch() | |
1521 statements, where XD_BYTECOUNT appears twice as a case tag. In | |
1522 each case, the two case blocks contain identical code, and you | |
1523 should *REMOVE THE SECOND* and leave the first. | |
1524 | 1228 |
1525 2001-09-17 Ben Wing <ben@xemacs.org> | 1229 2001-09-17 Ben Wing <ben@xemacs.org> |
1526 | 1230 |
1527 * fileio.c (normalize_filename): | 1231 * fileio.c (normalize_filename): |
1528 * fileio.c (Fexpand_file_name): | 1232 * fileio.c (Fexpand_file_name): |