Mercurial > hg > xemacs-beta
comparison src/eval.c @ 665:fdefd0186b75
[xemacs-hg @ 2001-09-20 06:28:42 by ben]
The great integral types renaming.
The purpose of this is to rationalize the names used for various
integral types, so that they match their intended uses and follow
consist conventions, and eliminate types that were not semantically
different from each other.
The conventions are:
-- All integral types that measure quantities of anything are
signed. Some people disagree vociferously with this, but their
arguments are mostly theoretical, and are vastly outweighed by
the practical headaches of mixing signed and unsigned values,
and more importantly by the far increased likelihood of
inadvertent bugs: Because of the broken "viral" nature of
unsigned quantities in C (operations involving mixed
signed/unsigned are done unsigned, when exactly the opposite is
nearly always wanted), even a single error in declaring a
quantity unsigned that should be signed, or even the even more
subtle error of comparing signed and unsigned values and
forgetting the necessary cast, can be catastrophic, as
comparisons will yield wrong results. -Wsign-compare is turned
on specifically to catch this, but this tends to result in a
great number of warnings when mixing signed and unsigned, and
the casts are annoying. More has been written on this
elsewhere.
-- All such quantity types just mentioned boil down to EMACS_INT,
which is 32 bits on 32-bit machines and 64 bits on 64-bit
machines. This is guaranteed to be the same size as Lisp
objects of type `int', and (as far as I can tell) of size_t
(unsigned!) and ssize_t. The only type below that is not an
EMACS_INT is Hashcode, which is an unsigned value of the same
size as EMACS_INT.
-- Type names should be relatively short (no more than 10
characters or so), with the first letter capitalized and no
underscores if they can at all be avoided.
-- "count" == a zero-based measurement of some quantity. Includes
sizes, offsets, and indexes.
-- "bpos" == a one-based measurement of a position in a buffer.
"Charbpos" and "Bytebpos" count text in the buffer, rather than
bytes in memory; thus Bytebpos does not directly correspond to
the memory representation. Use "Membpos" for this.
-- "Char" refers to internal-format characters, not to the C type
"char", which is really a byte.
-- For the actual name changes, see the script below.
I ran the following script to do the conversion. (NOTE: This script
is idempotent. You can safely run it multiple times and it will
not screw up previous results -- in fact, it will do nothing if
nothing has changed. Thus, it can be run repeatedly as necessary
to handle patches coming in from old workspaces, or old branches.)
There are two tags, just before and just after the change:
`pre-integral-type-rename' and `post-integral-type-rename'. When
merging code from the main trunk into a branch, the best thing to
do is first merge up to `pre-integral-type-rename', then apply the
script and associated changes, then merge from
`post-integral-type-change' to the present. (Alternatively, just do
the merging in one operation; but you may then have a lot of
conflicts needing to be resolved by hand.)
Script `fixtypes.sh' follows:
----------------------------------- cut ------------------------------------
files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]"
gr Memory_Count Bytecount $files
gr Lstream_Data_Count Bytecount $files
gr Element_Count Elemcount $files
gr Hash_Code Hashcode $files
gr extcount bytecount $files
gr bufpos charbpos $files
gr bytind bytebpos $files
gr memind membpos $files
gr bufbyte intbyte $files
gr Extcount Bytecount $files
gr Bufpos Charbpos $files
gr Bytind Bytebpos $files
gr Memind Membpos $files
gr Bufbyte Intbyte $files
gr EXTCOUNT BYTECOUNT $files
gr BUFPOS CHARBPOS $files
gr BYTIND BYTEBPOS $files
gr MEMIND MEMBPOS $files
gr BUFBYTE INTBYTE $files
gr MEMORY_COUNT BYTECOUNT $files
gr LSTREAM_DATA_COUNT BYTECOUNT $files
gr ELEMENT_COUNT ELEMCOUNT $files
gr HASH_CODE HASHCODE $files
----------------------------------- cut ------------------------------------
`fixtypes.sh' is a Bourne-shell script; it uses 'gr':
----------------------------------- cut ------------------------------------
#!/bin/sh
# Usage is like this:
# gr FROM TO FILES ...
# globally replace FROM with TO in FILES. FROM and TO are regular expressions.
# backup files are stored in the `backup' directory.
from="$1"
to="$2"
shift 2
echo ${1+"$@"} | xargs global-replace "s/$from/$to/g"
----------------------------------- cut ------------------------------------
`gr' in turn uses a Perl script to do its real work,
`global-replace', which follows:
----------------------------------- cut ------------------------------------
: #-*- Perl -*-
### global-modify --- modify the contents of a file by a Perl expression
## Copyright (C) 1999 Martin Buchholz.
## Copyright (C) 2001 Ben Wing.
## Authors: Martin Buchholz <martin@xemacs.org>, Ben Wing <ben@xemacs.org>
## Maintainer: Ben Wing <ben@xemacs.org>
## Current Version: 1.0, May 5, 2001
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with XEmacs; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
eval 'exec perl -w -S $0 ${1+"$@"}'
if 0;
use strict;
use FileHandle;
use Carp;
use Getopt::Long;
use File::Basename;
(my $myName = $0) =~ s@.*/@@; my $usage="
Usage: $myName [--help] [--backup-dir=DIR] [--line-mode] [--hunk-mode]
PERLEXPR FILE ...
Globally modify a file, either line by line or in one big hunk.
Typical usage is like this:
[with GNU print, GNU xargs: guaranteed to handle spaces, quotes, etc.
in file names]
find . -name '*.[ch]' -print0 | xargs -0 $0 's/\bCONST\b/const/g'\n
[with non-GNU print, xargs]
find . -name '*.[ch]' -print | xargs $0 's/\bCONST\b/const/g'\n
The file is read in, either line by line (with --line-mode specified)
or in one big hunk (with --hunk-mode specified; it's the default), and
the Perl expression is then evalled with \$_ set to the line or hunk of
text, including the terminating newline if there is one. It should
destructively modify the value there, storing the changed result in \$_.
Files in which any modifications are made are backed up to the directory
specified using --backup-dir, or to `backup' by default. To disable this,
use --backup-dir= with no argument.
Hunk mode is the default because it is MUCH MUCH faster than line-by-line.
Use line-by-line only when it matters, e.g. you want to do a replacement
only once per line (the default without the `g' argument). Conversely,
when using hunk mode, *ALWAYS* use `g'; otherwise, you will only make one
replacement in the entire file!
";
my %options = ();
$Getopt::Long::ignorecase = 0;
&GetOptions (
\%options,
'help', 'backup-dir=s', 'line-mode', 'hunk-mode',
);
die $usage if $options{"help"} or @ARGV <= 1;
my $code = shift;
die $usage if grep (-d || ! -w, @ARGV);
sub SafeOpen {
open ((my $fh = new FileHandle), $_[0]);
confess "Can't open $_[0]: $!" if ! defined $fh;
return $fh;
}
sub SafeClose {
close $_[0] or confess "Can't close $_[0]: $!";
}
sub FileContents {
my $fh = SafeOpen ("< $_[0]");
my $olddollarslash = $/;
local $/ = undef;
my $contents = <$fh>;
$/ = $olddollarslash;
return $contents;
}
sub WriteStringToFile {
my $fh = SafeOpen ("> $_[0]");
binmode $fh;
print $fh $_[1] or confess "$_[0]: $!\n";
SafeClose $fh;
}
foreach my $file (@ARGV) {
my $changed_p = 0;
my $new_contents = "";
if ($options{"line-mode"}) {
my $fh = SafeOpen $file;
while (<$fh>) {
my $save_line = $_;
eval $code;
$changed_p = 1 if $save_line ne $_;
$new_contents .= $_;
}
} else {
my $orig_contents = $_ = FileContents $file;
eval $code;
if ($_ ne $orig_contents) {
$changed_p = 1;
$new_contents = $_;
}
}
if ($changed_p) {
my $backdir = $options{"backup-dir"};
$backdir = "backup" if !defined ($backdir);
if ($backdir) {
my ($name, $path, $suffix) = fileparse ($file, "");
my $backfulldir = $path . $backdir;
my $backfile = "$backfulldir/$name";
mkdir $backfulldir, 0755 unless -d $backfulldir;
print "modifying $file (original saved in $backfile)\n";
rename $file, $backfile;
}
WriteStringToFile ($file, $new_contents);
}
}
----------------------------------- cut ------------------------------------
In addition to those programs, I needed to fix up a few other
things, particularly relating to the duplicate definitions of
types, now that some types merged with others. Specifically:
1. in lisp.h, removed duplicate declarations of Bytecount. The
changed code should now look like this: (In each code snippet
below, the first and last lines are the same as the original, as
are all lines outside of those lines. That allows you to locate
the section to be replaced, and replace the stuff in that
section, verifying that there isn't anything new added that
would need to be kept.)
--------------------------------- snip -------------------------------------
/* Counts of bytes or chars */
typedef EMACS_INT Bytecount;
typedef EMACS_INT Charcount;
/* Counts of elements */
typedef EMACS_INT Elemcount;
/* Hash codes */
typedef unsigned long Hashcode;
/* ------------------------ dynamic arrays ------------------- */
--------------------------------- snip -------------------------------------
2. in lstream.h, removed duplicate declaration of Bytecount.
Rewrote the comment about this type. The changed code should
now look like this:
--------------------------------- snip -------------------------------------
#endif
/* The have been some arguments over the what the type should be that
specifies a count of bytes in a data block to be written out or read in,
using Lstream_read(), Lstream_write(), and related functions.
Originally it was long, which worked fine; Martin "corrected" these to
size_t and ssize_t on the grounds that this is theoretically cleaner and
is in keeping with the C standards. Unfortunately, this practice is
horribly error-prone due to design flaws in the way that mixed
signed/unsigned arithmetic happens. In fact, by doing this change,
Martin introduced a subtle but fatal error that caused the operation of
sending large mail messages to the SMTP server under Windows to fail.
By putting all values back to be signed, avoiding any signed/unsigned
mixing, the bug immediately went away. The type then in use was
Lstream_Data_Count, so that it be reverted cleanly if a vote came to
that. Now it is Bytecount.
Some earlier comments about why the type must be signed: This MUST BE
SIGNED, since it also is used in functions that return the number of
bytes actually read to or written from in an operation, and these
functions can return -1 to signal error.
Note that the standard Unix read() and write() functions define the
count going in as a size_t, which is UNSIGNED, and the count going
out as an ssize_t, which is SIGNED. This is a horrible design
flaw. Not only is it highly likely to lead to logic errors when a
-1 gets interpreted as a large positive number, but operations are
bound to fail in all sorts of horrible ways when a number in the
upper-half of the size_t range is passed in -- this number is
unrepresentable as an ssize_t, so code that checks to see how many
bytes are actually written (which is mandatory if you are dealing
with certain types of devices) will get completely screwed up.
--ben
*/
typedef enum lstream_buffering
--------------------------------- snip -------------------------------------
3. in dumper.c, there are four places, all inside of switch()
statements, where XD_BYTECOUNT appears twice as a case tag. In
each case, the two case blocks contain identical code, and you
should *REMOVE THE SECOND* and leave the first.
author | ben |
---|---|
date | Thu, 20 Sep 2001 06:31:11 +0000 |
parents | b39c14581166 |
children | b1f74adcc1ff |
comparison
equal
deleted
inserted
replaced
664:6e99cc8c6ca5 | 665:fdefd0186b75 |
---|---|
282 | 282 |
283 static void | 283 static void |
284 print_subr (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | 284 print_subr (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) |
285 { | 285 { |
286 Lisp_Subr *subr = XSUBR (obj); | 286 Lisp_Subr *subr = XSUBR (obj); |
287 const CBufbyte *header = | 287 const CIntbyte *header = |
288 (subr->max_args == UNEVALLED) ? "#<special-form " : "#<subr "; | 288 (subr->max_args == UNEVALLED) ? "#<special-form " : "#<subr "; |
289 const CBufbyte *name = subr_name (subr); | 289 const CIntbyte *name = subr_name (subr); |
290 const CBufbyte *trailer = subr->prompt ? " (interactive)>" : ">"; | 290 const CIntbyte *trailer = subr->prompt ? " (interactive)>" : ">"; |
291 | 291 |
292 if (print_readably) | 292 if (print_readably) |
293 printing_unreadable_object ("%s%s%s", header, name, trailer); | 293 printing_unreadable_object ("%s%s%s", header, name, trailer); |
294 | 294 |
295 write_c_string (header, printcharfun); | 295 write_c_string (header, printcharfun); |
2315 | 2315 |
2316 /* Out of REASON and FROB, return a list of elements suitable for passing | 2316 /* Out of REASON and FROB, return a list of elements suitable for passing |
2317 to signal_error_1(). */ | 2317 to signal_error_1(). */ |
2318 | 2318 |
2319 Lisp_Object | 2319 Lisp_Object |
2320 build_error_data (const CBufbyte *reason, Lisp_Object frob) | 2320 build_error_data (const CIntbyte *reason, Lisp_Object frob) |
2321 { | 2321 { |
2322 if (EQ (frob, Qunbound)) | 2322 if (EQ (frob, Qunbound)) |
2323 frob = Qnil; | 2323 frob = Qnil; |
2324 else if (CONSP (frob) && EQ (XCAR (frob), Qunbound)) | 2324 else if (CONSP (frob) && EQ (XCAR (frob), Qunbound)) |
2325 frob = XCDR (frob); | 2325 frob = XCDR (frob); |
2330 else | 2330 else |
2331 return Fcons (build_translated_string (reason), frob); | 2331 return Fcons (build_translated_string (reason), frob); |
2332 } | 2332 } |
2333 | 2333 |
2334 DOESNT_RETURN | 2334 DOESNT_RETURN |
2335 signal_error (Lisp_Object type, const CBufbyte *reason, Lisp_Object frob) | 2335 signal_error (Lisp_Object type, const CIntbyte *reason, Lisp_Object frob) |
2336 { | 2336 { |
2337 signal_error_1 (type, build_error_data (reason, frob)); | 2337 signal_error_1 (type, build_error_data (reason, frob)); |
2338 } | 2338 } |
2339 | 2339 |
2340 void | 2340 void |
2341 maybe_signal_error (Lisp_Object type, const CBufbyte *reason, | 2341 maybe_signal_error (Lisp_Object type, const CIntbyte *reason, |
2342 Lisp_Object frob, Lisp_Object class, | 2342 Lisp_Object frob, Lisp_Object class, |
2343 Error_Behavior errb) | 2343 Error_Behavior errb) |
2344 { | 2344 { |
2345 /* Optimization: */ | 2345 /* Optimization: */ |
2346 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2346 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2347 return; | 2347 return; |
2348 maybe_signal_error_1 (type, build_error_data (reason, frob), class, errb); | 2348 maybe_signal_error_1 (type, build_error_data (reason, frob), class, errb); |
2349 } | 2349 } |
2350 | 2350 |
2351 Lisp_Object | 2351 Lisp_Object |
2352 signal_continuable_error (Lisp_Object type, const CBufbyte *reason, | 2352 signal_continuable_error (Lisp_Object type, const CIntbyte *reason, |
2353 Lisp_Object frob) | 2353 Lisp_Object frob) |
2354 { | 2354 { |
2355 return Fsignal (type, build_error_data (reason, frob)); | 2355 return Fsignal (type, build_error_data (reason, frob)); |
2356 } | 2356 } |
2357 | 2357 |
2358 Lisp_Object | 2358 Lisp_Object |
2359 maybe_signal_continuable_error (Lisp_Object type, const CBufbyte *reason, | 2359 maybe_signal_continuable_error (Lisp_Object type, const CIntbyte *reason, |
2360 Lisp_Object frob, Lisp_Object class, | 2360 Lisp_Object frob, Lisp_Object class, |
2361 Error_Behavior errb) | 2361 Error_Behavior errb) |
2362 { | 2362 { |
2363 /* Optimization: */ | 2363 /* Optimization: */ |
2364 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2364 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2376 is three objects, a string and two related Lisp objects. | 2376 is three objects, a string and two related Lisp objects. |
2377 (The equivalent could be accomplished using the class 2 functions, | 2377 (The equivalent could be accomplished using the class 2 functions, |
2378 but these are more convenient in this particular case.) */ | 2378 but these are more convenient in this particular case.) */ |
2379 | 2379 |
2380 DOESNT_RETURN | 2380 DOESNT_RETURN |
2381 signal_error_2 (Lisp_Object type, const CBufbyte *reason, | 2381 signal_error_2 (Lisp_Object type, const CIntbyte *reason, |
2382 Lisp_Object frob0, Lisp_Object frob1) | 2382 Lisp_Object frob0, Lisp_Object frob1) |
2383 { | 2383 { |
2384 signal_error_1 (type, list3 (build_translated_string (reason), frob0, | 2384 signal_error_1 (type, list3 (build_translated_string (reason), frob0, |
2385 frob1)); | 2385 frob1)); |
2386 } | 2386 } |
2387 | 2387 |
2388 void | 2388 void |
2389 maybe_signal_error_2 (Lisp_Object type, const CBufbyte *reason, | 2389 maybe_signal_error_2 (Lisp_Object type, const CIntbyte *reason, |
2390 Lisp_Object frob0, Lisp_Object frob1, | 2390 Lisp_Object frob0, Lisp_Object frob1, |
2391 Lisp_Object class, Error_Behavior errb) | 2391 Lisp_Object class, Error_Behavior errb) |
2392 { | 2392 { |
2393 /* Optimization: */ | 2393 /* Optimization: */ |
2394 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2394 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2396 maybe_signal_error_1 (type, list3 (build_translated_string (reason), frob0, | 2396 maybe_signal_error_1 (type, list3 (build_translated_string (reason), frob0, |
2397 frob1), class, errb); | 2397 frob1), class, errb); |
2398 } | 2398 } |
2399 | 2399 |
2400 Lisp_Object | 2400 Lisp_Object |
2401 signal_continuable_error_2 (Lisp_Object type, const CBufbyte *reason, | 2401 signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason, |
2402 Lisp_Object frob0, Lisp_Object frob1) | 2402 Lisp_Object frob0, Lisp_Object frob1) |
2403 { | 2403 { |
2404 return Fsignal (type, list3 (build_translated_string (reason), frob0, | 2404 return Fsignal (type, list3 (build_translated_string (reason), frob0, |
2405 frob1)); | 2405 frob1)); |
2406 } | 2406 } |
2407 | 2407 |
2408 Lisp_Object | 2408 Lisp_Object |
2409 maybe_signal_continuable_error_2 (Lisp_Object type, const CBufbyte *reason, | 2409 maybe_signal_continuable_error_2 (Lisp_Object type, const CIntbyte *reason, |
2410 Lisp_Object frob0, Lisp_Object frob1, | 2410 Lisp_Object frob0, Lisp_Object frob1, |
2411 Lisp_Object class, Error_Behavior errb) | 2411 Lisp_Object class, Error_Behavior errb) |
2412 { | 2412 { |
2413 /* Optimization: */ | 2413 /* Optimization: */ |
2414 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2414 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2424 /* Class 4: Printf-like functions that signal an error. | 2424 /* Class 4: Printf-like functions that signal an error. |
2425 These functions signal an error of a specified type, whose data | 2425 These functions signal an error of a specified type, whose data |
2426 is a single string, created using the arguments. */ | 2426 is a single string, created using the arguments. */ |
2427 | 2427 |
2428 DOESNT_RETURN | 2428 DOESNT_RETURN |
2429 signal_ferror (Lisp_Object type, const CBufbyte *fmt, ...) | 2429 signal_ferror (Lisp_Object type, const CIntbyte *fmt, ...) |
2430 { | 2430 { |
2431 Lisp_Object obj; | 2431 Lisp_Object obj; |
2432 va_list args; | 2432 va_list args; |
2433 | 2433 |
2434 va_start (args, fmt); | 2434 va_start (args, fmt); |
2435 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2435 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2436 args); | 2436 args); |
2437 va_end (args); | 2437 va_end (args); |
2438 | 2438 |
2439 /* Fsignal GC-protects its args */ | 2439 /* Fsignal GC-protects its args */ |
2440 signal_error (type, 0, obj); | 2440 signal_error (type, 0, obj); |
2441 } | 2441 } |
2442 | 2442 |
2443 void | 2443 void |
2444 maybe_signal_ferror (Lisp_Object type, Lisp_Object class, Error_Behavior errb, | 2444 maybe_signal_ferror (Lisp_Object type, Lisp_Object class, Error_Behavior errb, |
2445 const CBufbyte *fmt, ...) | 2445 const CIntbyte *fmt, ...) |
2446 { | 2446 { |
2447 Lisp_Object obj; | 2447 Lisp_Object obj; |
2448 va_list args; | 2448 va_list args; |
2449 | 2449 |
2450 /* Optimization: */ | 2450 /* Optimization: */ |
2451 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2451 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2452 return; | 2452 return; |
2453 | 2453 |
2454 va_start (args, fmt); | 2454 va_start (args, fmt); |
2455 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2455 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2456 args); | 2456 args); |
2457 va_end (args); | 2457 va_end (args); |
2458 | 2458 |
2459 /* Fsignal GC-protects its args */ | 2459 /* Fsignal GC-protects its args */ |
2460 maybe_signal_error (type, 0, obj, class, errb); | 2460 maybe_signal_error (type, 0, obj, class, errb); |
2461 } | 2461 } |
2462 | 2462 |
2463 Lisp_Object | 2463 Lisp_Object |
2464 signal_continuable_ferror (Lisp_Object type, const CBufbyte *fmt, ...) | 2464 signal_continuable_ferror (Lisp_Object type, const CIntbyte *fmt, ...) |
2465 { | 2465 { |
2466 Lisp_Object obj; | 2466 Lisp_Object obj; |
2467 va_list args; | 2467 va_list args; |
2468 | 2468 |
2469 va_start (args, fmt); | 2469 va_start (args, fmt); |
2470 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2470 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2471 args); | 2471 args); |
2472 va_end (args); | 2472 va_end (args); |
2473 | 2473 |
2474 /* Fsignal GC-protects its args */ | 2474 /* Fsignal GC-protects its args */ |
2475 return Fsignal (type, list1 (obj)); | 2475 return Fsignal (type, list1 (obj)); |
2476 } | 2476 } |
2477 | 2477 |
2478 Lisp_Object | 2478 Lisp_Object |
2479 maybe_signal_continuable_ferror (Lisp_Object type, Lisp_Object class, | 2479 maybe_signal_continuable_ferror (Lisp_Object type, Lisp_Object class, |
2480 Error_Behavior errb, const CBufbyte *fmt, ...) | 2480 Error_Behavior errb, const CIntbyte *fmt, ...) |
2481 { | 2481 { |
2482 Lisp_Object obj; | 2482 Lisp_Object obj; |
2483 va_list args; | 2483 va_list args; |
2484 | 2484 |
2485 /* Optimization: */ | 2485 /* Optimization: */ |
2486 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2486 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2487 return Qnil; | 2487 return Qnil; |
2488 | 2488 |
2489 va_start (args, fmt); | 2489 va_start (args, fmt); |
2490 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2490 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2491 args); | 2491 args); |
2492 va_end (args); | 2492 va_end (args); |
2493 | 2493 |
2494 /* Fsignal GC-protects its args */ | 2494 /* Fsignal GC-protects its args */ |
2495 return maybe_signal_continuable_error (type, 0, obj, class, errb); | 2495 return maybe_signal_continuable_error (type, 0, obj, class, errb); |
2509 elements, the first of which is Qunbound), and these functions are | 2509 elements, the first of which is Qunbound), and these functions are |
2510 not commonly used. | 2510 not commonly used. |
2511 */ | 2511 */ |
2512 | 2512 |
2513 DOESNT_RETURN | 2513 DOESNT_RETURN |
2514 signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const CBufbyte *fmt, | 2514 signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, const CIntbyte *fmt, |
2515 ...) | 2515 ...) |
2516 { | 2516 { |
2517 Lisp_Object obj; | 2517 Lisp_Object obj; |
2518 va_list args; | 2518 va_list args; |
2519 | 2519 |
2520 va_start (args, fmt); | 2520 va_start (args, fmt); |
2521 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2521 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2522 args); | 2522 args); |
2523 va_end (args); | 2523 va_end (args); |
2524 | 2524 |
2525 /* Fsignal GC-protects its args */ | 2525 /* Fsignal GC-protects its args */ |
2526 signal_error_1 (type, Fcons (obj, build_error_data (0, frob))); | 2526 signal_error_1 (type, Fcons (obj, build_error_data (0, frob))); |
2527 } | 2527 } |
2528 | 2528 |
2529 void | 2529 void |
2530 maybe_signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, | 2530 maybe_signal_ferror_with_frob (Lisp_Object type, Lisp_Object frob, |
2531 Lisp_Object class, Error_Behavior errb, | 2531 Lisp_Object class, Error_Behavior errb, |
2532 const CBufbyte *fmt, ...) | 2532 const CIntbyte *fmt, ...) |
2533 { | 2533 { |
2534 Lisp_Object obj; | 2534 Lisp_Object obj; |
2535 va_list args; | 2535 va_list args; |
2536 | 2536 |
2537 /* Optimization: */ | 2537 /* Optimization: */ |
2538 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2538 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2539 return; | 2539 return; |
2540 | 2540 |
2541 va_start (args, fmt); | 2541 va_start (args, fmt); |
2542 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2542 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2543 args); | 2543 args); |
2544 va_end (args); | 2544 va_end (args); |
2545 | 2545 |
2546 /* Fsignal GC-protects its args */ | 2546 /* Fsignal GC-protects its args */ |
2547 maybe_signal_error_1 (type, Fcons (obj, build_error_data (0, frob)), class, | 2547 maybe_signal_error_1 (type, Fcons (obj, build_error_data (0, frob)), class, |
2548 errb); | 2548 errb); |
2549 } | 2549 } |
2550 | 2550 |
2551 Lisp_Object | 2551 Lisp_Object |
2552 signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, | 2552 signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, |
2553 const CBufbyte *fmt, ...) | 2553 const CIntbyte *fmt, ...) |
2554 { | 2554 { |
2555 Lisp_Object obj; | 2555 Lisp_Object obj; |
2556 va_list args; | 2556 va_list args; |
2557 | 2557 |
2558 va_start (args, fmt); | 2558 va_start (args, fmt); |
2559 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2559 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2560 args); | 2560 args); |
2561 va_end (args); | 2561 va_end (args); |
2562 | 2562 |
2563 /* Fsignal GC-protects its args */ | 2563 /* Fsignal GC-protects its args */ |
2564 return Fsignal (type, Fcons (obj, build_error_data (0, frob))); | 2564 return Fsignal (type, Fcons (obj, build_error_data (0, frob))); |
2566 | 2566 |
2567 Lisp_Object | 2567 Lisp_Object |
2568 maybe_signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, | 2568 maybe_signal_continuable_ferror_with_frob (Lisp_Object type, Lisp_Object frob, |
2569 Lisp_Object class, | 2569 Lisp_Object class, |
2570 Error_Behavior errb, | 2570 Error_Behavior errb, |
2571 const CBufbyte *fmt, ...) | 2571 const CIntbyte *fmt, ...) |
2572 { | 2572 { |
2573 Lisp_Object obj; | 2573 Lisp_Object obj; |
2574 va_list args; | 2574 va_list args; |
2575 | 2575 |
2576 /* Optimization: */ | 2576 /* Optimization: */ |
2577 if (ERRB_EQ (errb, ERROR_ME_NOT)) | 2577 if (ERRB_EQ (errb, ERROR_ME_NOT)) |
2578 return Qnil; | 2578 return Qnil; |
2579 | 2579 |
2580 va_start (args, fmt); | 2580 va_start (args, fmt); |
2581 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2581 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2582 args); | 2582 args); |
2583 va_end (args); | 2583 va_end (args); |
2584 | 2584 |
2585 /* Fsignal GC-protects its args */ | 2585 /* Fsignal GC-protects its args */ |
2586 return maybe_signal_continuable_error_1 (type, | 2586 return maybe_signal_continuable_error_1 (type, |
2648 { | 2648 { |
2649 signal_error (Qcircular_property_list, 0, list); | 2649 signal_error (Qcircular_property_list, 0, list); |
2650 } | 2650 } |
2651 | 2651 |
2652 DOESNT_RETURN | 2652 DOESNT_RETURN |
2653 syntax_error (const CBufbyte *reason, Lisp_Object frob) | 2653 syntax_error (const CIntbyte *reason, Lisp_Object frob) |
2654 { | 2654 { |
2655 signal_error (Qsyntax_error, reason, frob); | 2655 signal_error (Qsyntax_error, reason, frob); |
2656 } | 2656 } |
2657 | 2657 |
2658 DOESNT_RETURN | 2658 DOESNT_RETURN |
2659 syntax_error_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2) | 2659 syntax_error_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) |
2660 { | 2660 { |
2661 signal_error_2 (Qsyntax_error, reason, frob1, frob2); | 2661 signal_error_2 (Qsyntax_error, reason, frob1, frob2); |
2662 } | 2662 } |
2663 | 2663 |
2664 void | 2664 void |
2665 maybe_syntax_error (const CBufbyte *reason, Lisp_Object frob, | 2665 maybe_syntax_error (const CIntbyte *reason, Lisp_Object frob, |
2666 Lisp_Object class, Error_Behavior errb) | 2666 Lisp_Object class, Error_Behavior errb) |
2667 { | 2667 { |
2668 maybe_signal_error (Qsyntax_error, reason, frob, class, errb); | 2668 maybe_signal_error (Qsyntax_error, reason, frob, class, errb); |
2669 } | 2669 } |
2670 | 2670 |
2671 DOESNT_RETURN | 2671 DOESNT_RETURN |
2672 sferror (const CBufbyte *reason, Lisp_Object frob) | 2672 sferror (const CIntbyte *reason, Lisp_Object frob) |
2673 { | 2673 { |
2674 signal_error (Qstructure_formation_error, reason, frob); | 2674 signal_error (Qstructure_formation_error, reason, frob); |
2675 } | 2675 } |
2676 | 2676 |
2677 DOESNT_RETURN | 2677 DOESNT_RETURN |
2678 sferror_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2) | 2678 sferror_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) |
2679 { | 2679 { |
2680 signal_error_2 (Qstructure_formation_error, reason, frob1, frob2); | 2680 signal_error_2 (Qstructure_formation_error, reason, frob1, frob2); |
2681 } | 2681 } |
2682 | 2682 |
2683 void | 2683 void |
2684 maybe_sferror (const CBufbyte *reason, Lisp_Object frob, | 2684 maybe_sferror (const CIntbyte *reason, Lisp_Object frob, |
2685 Lisp_Object class, Error_Behavior errb) | 2685 Lisp_Object class, Error_Behavior errb) |
2686 { | 2686 { |
2687 maybe_signal_error (Qstructure_formation_error, reason, frob, class, errb); | 2687 maybe_signal_error (Qstructure_formation_error, reason, frob, class, errb); |
2688 } | 2688 } |
2689 | 2689 |
2690 DOESNT_RETURN | 2690 DOESNT_RETURN |
2691 invalid_argument (const CBufbyte *reason, Lisp_Object frob) | 2691 invalid_argument (const CIntbyte *reason, Lisp_Object frob) |
2692 { | 2692 { |
2693 signal_error (Qinvalid_argument, reason, frob); | 2693 signal_error (Qinvalid_argument, reason, frob); |
2694 } | 2694 } |
2695 | 2695 |
2696 DOESNT_RETURN | 2696 DOESNT_RETURN |
2697 invalid_argument_2 (const CBufbyte *reason, Lisp_Object frob1, | 2697 invalid_argument_2 (const CIntbyte *reason, Lisp_Object frob1, |
2698 Lisp_Object frob2) | 2698 Lisp_Object frob2) |
2699 { | 2699 { |
2700 signal_error_2 (Qinvalid_argument, reason, frob1, frob2); | 2700 signal_error_2 (Qinvalid_argument, reason, frob1, frob2); |
2701 } | 2701 } |
2702 | 2702 |
2703 void | 2703 void |
2704 maybe_invalid_argument (const CBufbyte *reason, Lisp_Object frob, | 2704 maybe_invalid_argument (const CIntbyte *reason, Lisp_Object frob, |
2705 Lisp_Object class, Error_Behavior errb) | 2705 Lisp_Object class, Error_Behavior errb) |
2706 { | 2706 { |
2707 maybe_signal_error (Qinvalid_argument, reason, frob, class, errb); | 2707 maybe_signal_error (Qinvalid_argument, reason, frob, class, errb); |
2708 } | 2708 } |
2709 | 2709 |
2710 DOESNT_RETURN | 2710 DOESNT_RETURN |
2711 invalid_constant (const CBufbyte *reason, Lisp_Object frob) | 2711 invalid_constant (const CIntbyte *reason, Lisp_Object frob) |
2712 { | 2712 { |
2713 signal_error (Qinvalid_constant, reason, frob); | 2713 signal_error (Qinvalid_constant, reason, frob); |
2714 } | 2714 } |
2715 | 2715 |
2716 DOESNT_RETURN | 2716 DOESNT_RETURN |
2717 invalid_constant_2 (const CBufbyte *reason, Lisp_Object frob1, | 2717 invalid_constant_2 (const CIntbyte *reason, Lisp_Object frob1, |
2718 Lisp_Object frob2) | 2718 Lisp_Object frob2) |
2719 { | 2719 { |
2720 signal_error_2 (Qinvalid_constant, reason, frob1, frob2); | 2720 signal_error_2 (Qinvalid_constant, reason, frob1, frob2); |
2721 } | 2721 } |
2722 | 2722 |
2723 void | 2723 void |
2724 maybe_invalid_constant (const CBufbyte *reason, Lisp_Object frob, | 2724 maybe_invalid_constant (const CIntbyte *reason, Lisp_Object frob, |
2725 Lisp_Object class, Error_Behavior errb) | 2725 Lisp_Object class, Error_Behavior errb) |
2726 { | 2726 { |
2727 maybe_signal_error (Qinvalid_constant, reason, frob, class, errb); | 2727 maybe_signal_error (Qinvalid_constant, reason, frob, class, errb); |
2728 } | 2728 } |
2729 | 2729 |
2730 DOESNT_RETURN | 2730 DOESNT_RETURN |
2731 invalid_operation (const CBufbyte *reason, Lisp_Object frob) | 2731 invalid_operation (const CIntbyte *reason, Lisp_Object frob) |
2732 { | 2732 { |
2733 signal_error (Qinvalid_operation, reason, frob); | 2733 signal_error (Qinvalid_operation, reason, frob); |
2734 } | 2734 } |
2735 | 2735 |
2736 DOESNT_RETURN | 2736 DOESNT_RETURN |
2737 invalid_operation_2 (const CBufbyte *reason, Lisp_Object frob1, | 2737 invalid_operation_2 (const CIntbyte *reason, Lisp_Object frob1, |
2738 Lisp_Object frob2) | 2738 Lisp_Object frob2) |
2739 { | 2739 { |
2740 signal_error_2 (Qinvalid_operation, reason, frob1, frob2); | 2740 signal_error_2 (Qinvalid_operation, reason, frob1, frob2); |
2741 } | 2741 } |
2742 | 2742 |
2743 void | 2743 void |
2744 maybe_invalid_operation (const CBufbyte *reason, Lisp_Object frob, | 2744 maybe_invalid_operation (const CIntbyte *reason, Lisp_Object frob, |
2745 Lisp_Object class, Error_Behavior errb) | 2745 Lisp_Object class, Error_Behavior errb) |
2746 { | 2746 { |
2747 maybe_signal_error (Qinvalid_operation, reason, frob, class, errb); | 2747 maybe_signal_error (Qinvalid_operation, reason, frob, class, errb); |
2748 } | 2748 } |
2749 | 2749 |
2750 DOESNT_RETURN | 2750 DOESNT_RETURN |
2751 invalid_change (const CBufbyte *reason, Lisp_Object frob) | 2751 invalid_change (const CIntbyte *reason, Lisp_Object frob) |
2752 { | 2752 { |
2753 signal_error (Qinvalid_change, reason, frob); | 2753 signal_error (Qinvalid_change, reason, frob); |
2754 } | 2754 } |
2755 | 2755 |
2756 DOESNT_RETURN | 2756 DOESNT_RETURN |
2757 invalid_change_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2) | 2757 invalid_change_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) |
2758 { | 2758 { |
2759 signal_error_2 (Qinvalid_change, reason, frob1, frob2); | 2759 signal_error_2 (Qinvalid_change, reason, frob1, frob2); |
2760 } | 2760 } |
2761 | 2761 |
2762 void | 2762 void |
2763 maybe_invalid_change (const CBufbyte *reason, Lisp_Object frob, | 2763 maybe_invalid_change (const CIntbyte *reason, Lisp_Object frob, |
2764 Lisp_Object class, Error_Behavior errb) | 2764 Lisp_Object class, Error_Behavior errb) |
2765 { | 2765 { |
2766 maybe_signal_error (Qinvalid_change, reason, frob, class, errb); | 2766 maybe_signal_error (Qinvalid_change, reason, frob, class, errb); |
2767 } | 2767 } |
2768 | 2768 |
2769 DOESNT_RETURN | 2769 DOESNT_RETURN |
2770 invalid_state (const CBufbyte *reason, Lisp_Object frob) | 2770 invalid_state (const CIntbyte *reason, Lisp_Object frob) |
2771 { | 2771 { |
2772 signal_error (Qinvalid_state, reason, frob); | 2772 signal_error (Qinvalid_state, reason, frob); |
2773 } | 2773 } |
2774 | 2774 |
2775 DOESNT_RETURN | 2775 DOESNT_RETURN |
2776 invalid_state_2 (const CBufbyte *reason, Lisp_Object frob1, Lisp_Object frob2) | 2776 invalid_state_2 (const CIntbyte *reason, Lisp_Object frob1, Lisp_Object frob2) |
2777 { | 2777 { |
2778 signal_error_2 (Qinvalid_state, reason, frob1, frob2); | 2778 signal_error_2 (Qinvalid_state, reason, frob1, frob2); |
2779 } | 2779 } |
2780 | 2780 |
2781 void | 2781 void |
2782 maybe_invalid_state (const CBufbyte *reason, Lisp_Object frob, | 2782 maybe_invalid_state (const CIntbyte *reason, Lisp_Object frob, |
2783 Lisp_Object class, Error_Behavior errb) | 2783 Lisp_Object class, Error_Behavior errb) |
2784 { | 2784 { |
2785 maybe_signal_error (Qinvalid_state, reason, frob, class, errb); | 2785 maybe_signal_error (Qinvalid_state, reason, frob, class, errb); |
2786 } | 2786 } |
2787 | 2787 |
2788 DOESNT_RETURN | 2788 DOESNT_RETURN |
2789 wtaerror (const CBufbyte *reason, Lisp_Object frob) | 2789 wtaerror (const CIntbyte *reason, Lisp_Object frob) |
2790 { | 2790 { |
2791 signal_error (Qwrong_type_argument, reason, frob); | 2791 signal_error (Qwrong_type_argument, reason, frob); |
2792 } | 2792 } |
2793 | 2793 |
2794 DOESNT_RETURN | 2794 DOESNT_RETURN |
2795 stack_overflow (const CBufbyte *reason, Lisp_Object frob) | 2795 stack_overflow (const CIntbyte *reason, Lisp_Object frob) |
2796 { | 2796 { |
2797 signal_error (Qstack_overflow, reason, frob); | 2797 signal_error (Qstack_overflow, reason, frob); |
2798 } | 2798 } |
2799 | 2799 |
2800 DOESNT_RETURN | 2800 DOESNT_RETURN |
2801 out_of_memory (const CBufbyte *reason, Lisp_Object frob) | 2801 out_of_memory (const CIntbyte *reason, Lisp_Object frob) |
2802 { | 2802 { |
2803 signal_error (Qout_of_memory, reason, frob); | 2803 signal_error (Qout_of_memory, reason, frob); |
2804 } | 2804 } |
2805 | 2805 |
2806 DOESNT_RETURN | 2806 DOESNT_RETURN |
2807 printing_unreadable_object (const CBufbyte *fmt, ...) | 2807 printing_unreadable_object (const CIntbyte *fmt, ...) |
2808 { | 2808 { |
2809 Lisp_Object obj; | 2809 Lisp_Object obj; |
2810 va_list args; | 2810 va_list args; |
2811 | 2811 |
2812 va_start (args, fmt); | 2812 va_start (args, fmt); |
2813 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), Qnil, -1, | 2813 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), Qnil, -1, |
2814 args); | 2814 args); |
2815 va_end (args); | 2815 va_end (args); |
2816 | 2816 |
2817 /* Fsignal GC-protects its args */ | 2817 /* Fsignal GC-protects its args */ |
2818 signal_error (Qprinting_unreadable_object, 0, obj); | 2818 signal_error (Qprinting_unreadable_object, 0, obj); |
4433 { | 4433 { |
4434 Lisp_Object args[2]; | 4434 Lisp_Object args[2]; |
4435 | 4435 |
4436 if (!NILP (arg)) | 4436 if (!NILP (arg)) |
4437 { | 4437 { |
4438 CBufbyte *str = (CBufbyte *) get_opaque_ptr (arg); | 4438 CIntbyte *str = (CIntbyte *) get_opaque_ptr (arg); |
4439 args[0] = build_string (str); | 4439 args[0] = build_string (str); |
4440 } | 4440 } |
4441 else | 4441 else |
4442 args[0] = build_string ("error"); | 4442 args[0] = build_string ("error"); |
4443 /* #### This should call | 4443 /* #### This should call |
4444 (with-output-to-string (display-error errordata)) | 4444 (with-output-to-string (display-error errordata)) |
4445 but that stuff is all in Lisp currently. */ | 4445 but that stuff is all in Lisp currently. */ |
4446 args[1] = errordata; | 4446 args[1] = errordata; |
4447 warn_when_safe_lispobj | 4447 warn_when_safe_lispobj |
4448 (Qerror, Qwarning, | 4448 (Qerror, Qwarning, |
4449 emacs_doprnt_string_lisp ((const Bufbyte *) "%s: %s", | 4449 emacs_doprnt_string_lisp ((const Intbyte *) "%s: %s", |
4450 Qnil, -1, 2, args)); | 4450 Qnil, -1, 2, args)); |
4451 } | 4451 } |
4452 return Qunbound; | 4452 return Qunbound; |
4453 } | 4453 } |
4454 | 4454 |
4487 { | 4487 { |
4488 return eval_in_buffer (XBUFFER (XCAR (cons)), XCDR (cons)); | 4488 return eval_in_buffer (XBUFFER (XCAR (cons)), XCDR (cons)); |
4489 } | 4489 } |
4490 | 4490 |
4491 Lisp_Object | 4491 Lisp_Object |
4492 eval_in_buffer_trapping_errors (const CBufbyte *warning_string, | 4492 eval_in_buffer_trapping_errors (const CIntbyte *warning_string, |
4493 struct buffer *buf, Lisp_Object form) | 4493 struct buffer *buf, Lisp_Object form) |
4494 { | 4494 { |
4495 int speccount = specpdl_depth(); | 4495 int speccount = specpdl_depth(); |
4496 Lisp_Object tem; | 4496 Lisp_Object tem; |
4497 Lisp_Object buffer; | 4497 Lisp_Object buffer; |
4527 run_hook (hook_symbol); | 4527 run_hook (hook_symbol); |
4528 return Qnil; | 4528 return Qnil; |
4529 } | 4529 } |
4530 | 4530 |
4531 Lisp_Object | 4531 Lisp_Object |
4532 run_hook_trapping_errors (const CBufbyte *warning_string, | 4532 run_hook_trapping_errors (const CIntbyte *warning_string, |
4533 Lisp_Object hook_symbol) | 4533 Lisp_Object hook_symbol) |
4534 { | 4534 { |
4535 int speccount; | 4535 int speccount; |
4536 Lisp_Object tem; | 4536 Lisp_Object tem; |
4537 Lisp_Object opaque; | 4537 Lisp_Object opaque; |
4561 | 4561 |
4562 /* Same as run_hook_trapping_errors() but also set the hook to nil | 4562 /* Same as run_hook_trapping_errors() but also set the hook to nil |
4563 if an error occurs. */ | 4563 if an error occurs. */ |
4564 | 4564 |
4565 Lisp_Object | 4565 Lisp_Object |
4566 safe_run_hook_trapping_errors (const CBufbyte *warning_string, | 4566 safe_run_hook_trapping_errors (const CIntbyte *warning_string, |
4567 Lisp_Object hook_symbol, | 4567 Lisp_Object hook_symbol, |
4568 int allow_quit) | 4568 int allow_quit) |
4569 { | 4569 { |
4570 int speccount = specpdl_depth(); | 4570 int speccount = specpdl_depth(); |
4571 Lisp_Object tem; | 4571 Lisp_Object tem; |
4607 /* This function can GC */ | 4607 /* This function can GC */ |
4608 return call0 (function); | 4608 return call0 (function); |
4609 } | 4609 } |
4610 | 4610 |
4611 Lisp_Object | 4611 Lisp_Object |
4612 call0_trapping_errors (const CBufbyte *warning_string, Lisp_Object function) | 4612 call0_trapping_errors (const CIntbyte *warning_string, Lisp_Object function) |
4613 { | 4613 { |
4614 int speccount; | 4614 int speccount; |
4615 Lisp_Object tem; | 4615 Lisp_Object tem; |
4616 Lisp_Object opaque = Qnil; | 4616 Lisp_Object opaque = Qnil; |
4617 struct gcpro gcpro1, gcpro2; | 4617 struct gcpro gcpro1, gcpro2; |
4654 /* This function can GC */ | 4654 /* This function can GC */ |
4655 return call2 (XCAR (cons), XCAR (XCDR (cons)), XCAR (XCDR (XCDR (cons)))); | 4655 return call2 (XCAR (cons), XCAR (XCDR (cons)), XCAR (XCDR (XCDR (cons)))); |
4656 } | 4656 } |
4657 | 4657 |
4658 Lisp_Object | 4658 Lisp_Object |
4659 call1_trapping_errors (const CBufbyte *warning_string, Lisp_Object function, | 4659 call1_trapping_errors (const CIntbyte *warning_string, Lisp_Object function, |
4660 Lisp_Object object) | 4660 Lisp_Object object) |
4661 { | 4661 { |
4662 int speccount = specpdl_depth(); | 4662 int speccount = specpdl_depth(); |
4663 Lisp_Object tem; | 4663 Lisp_Object tem; |
4664 Lisp_Object cons = Qnil; | 4664 Lisp_Object cons = Qnil; |
4691 /* gc_currently_forbidden = 0; */ | 4691 /* gc_currently_forbidden = 0; */ |
4692 return unbind_to (speccount, tem); | 4692 return unbind_to (speccount, tem); |
4693 } | 4693 } |
4694 | 4694 |
4695 Lisp_Object | 4695 Lisp_Object |
4696 call2_trapping_errors (const CBufbyte *warning_string, Lisp_Object function, | 4696 call2_trapping_errors (const CIntbyte *warning_string, Lisp_Object function, |
4697 Lisp_Object object1, Lisp_Object object2) | 4697 Lisp_Object object1, Lisp_Object object2) |
4698 { | 4698 { |
4699 int speccount = specpdl_depth(); | 4699 int speccount = specpdl_depth(); |
4700 Lisp_Object tem; | 4700 Lisp_Object tem; |
4701 Lisp_Object cons = Qnil; | 4701 Lisp_Object cons = Qnil; |
5248 An alternative approach is to just pass some non-string type of | 5248 An alternative approach is to just pass some non-string type of |
5249 Lisp_Object to warn_when_safe_lispobj(); `prin1-to-string' will | 5249 Lisp_Object to warn_when_safe_lispobj(); `prin1-to-string' will |
5250 automatically be called when it is safe to do so. */ | 5250 automatically be called when it is safe to do so. */ |
5251 | 5251 |
5252 void | 5252 void |
5253 warn_when_safe (Lisp_Object class, Lisp_Object level, const CBufbyte *fmt, ...) | 5253 warn_when_safe (Lisp_Object class, Lisp_Object level, const CIntbyte *fmt, ...) |
5254 { | 5254 { |
5255 Lisp_Object obj; | 5255 Lisp_Object obj; |
5256 va_list args; | 5256 va_list args; |
5257 | 5257 |
5258 va_start (args, fmt); | 5258 va_start (args, fmt); |
5259 obj = emacs_doprnt_string_va ((const Bufbyte *) GETTEXT (fmt), | 5259 obj = emacs_doprnt_string_va ((const Intbyte *) GETTEXT (fmt), |
5260 Qnil, -1, args); | 5260 Qnil, -1, args); |
5261 va_end (args); | 5261 va_end (args); |
5262 | 5262 |
5263 warn_when_safe_lispobj (class, level, obj); | 5263 warn_when_safe_lispobj (class, level, obj); |
5264 } | 5264 } |