unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: RE_TRANSLATE_P
Date: Mon, 29 Nov 2004 10:12:55 +0100	[thread overview]
Message-ID: <m3pt1x6mso.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <E1CYemL-0002XE-OV@fencepost.gnu.org> (Richard Stallman's message of "Mon, 29 Nov 2004 01:12:53 -0500")

Richard Stallman <rms@gnu.org> writes:

>     This causes RE_TRANSLATE_P to invoke a function, at least if compilers
>     other than GCC are used.  I wonder why replacing XFASTINT with XINT
>     was not enough to fix the original problem?
>
> Would this make it right?

It seems like that change was made in several places, so perhaps
we should have a ZEROP macro to test such cases in a portable
manner.  

It would also make the code cleaner:

ZEROP (obj)

is much easier to understand at a glance than

EQ (obj, make_number (0))


A possible definition would be:

#ifdef __GCC__
#define ZEROP(obj) (!EQ ((obj), make_number (0)))
#else
#define ZEROP(obj) (!(INTEGERP ((obj)) && XINT ((obj)) == 0))
#endif

But the second form evals 'obj' twice, so we need a BIG FAT WARNING
when using ZEROP, or find some other portable way to implement it.


I could make that change.

>
> *** config.in	23 Nov 2004 11:44:45 -0500	1.203
> --- config.in	29 Nov 2004 00:30:17 -0500	
> ***************
> *** 969,975 ****
> --- 969,979 ----
>   /* Tell regex.c to use a type compatible with Emacs.  */
>   #define RE_TRANSLATE_TYPE Lisp_Object
>   #define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
> + #ifdef __GCC__
>   #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
> + #else
> + #define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
> + #endif
>   #endif
>   
>   /* Avoid link-time collision with system mktime if we will use our own.  */
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>
>

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2004-11-29  9:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-26 11:30 RE_TRANSLATE_P Eli Zaretskii
2004-11-29  6:12 ` RE_TRANSLATE_P Richard Stallman
2004-11-29  9:12   ` Kim F. Storm [this message]
2004-11-30  7:02     ` RE_TRANSLATE_P Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3pt1x6mso.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).