emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming non-X x_* procedures in xdisp.c (and elsewhere)


From: Alex
Subject: Re: Renaming non-X x_* procedures in xdisp.c (and elsewhere)
Date: Sat, 23 Mar 2019 22:50:45 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> I don't have strong opinions about this.  Aside of making the
> archeology and forensics harder, renaming will get in the way of my
> personal acquaintance with the code in xdisp.c and dispnew.c, but that
> alone doesn't sound like a reason to object to the change.  It will
> probably also require a lot more ugly #ifdef's in the mainline code
> (or calling through function pointers, not sure which is worse), and
> quite a few changes in the headers to go with that.

How about using something like the following? It's ugly, but at least
it doesn't ruin the rest of the code.

#ifdef HAVE_X_WINDOWS
#define CASE_X(proc, ...)                       \
  case output_x_window:                         \
  x_ ## proc (__VAR_ARGS__)
#define CASE_X_VAR(var, proc, ...)              \
  case output_x_window:                         \
  var = x_ ## proc (__VA_ARGS__)
#else
#define CASE_X(...)
#define CASE_X_VAR(...)
#endif

#ifdef HAVE_NTGUI
#define CASE_W32(proc, ...)                     \
  case output_w32:                              \
  w32_ ## proc (__VA_ARGS__)
#define CASE_W32_VAR(var, proc, ...)            \
  case output_w32:                              \
  var = w32_ ## proc (__VA_ARGS__)
#else
#define CASE_W32(...)
#define CASE_W32_VAR(...)
#endif

#ifdef HAVE_NS
#define CASE_NS(proc, ...)                      \
  case output_ns:                               \
  ns_ ## proc (__VA_ARGS__)
#define CASE_NS_VAR(var, proc, ...)             \
  case output_ns:                               \
  var = ns_ ## proc (__VA_ARGS__)
#else
#define CASE_NS(...)
#define CASE_NS_VAR(...)
#endif

#define CALL_FOR_WS(f, proc, ...)               \
  switch ((f)->output_method)                   \
    {                                           \
      CASE_X (proc, __VA_ARGS__);               \
      CASE_W32 (proc, __VA_ARGS__);             \
      CASE_NS (proc, __VA_ARGS__);              \
    }

#define ASSIGN_FOR_WS(f, var, proc, ...)        \
  switch ((f)->output_method)                   \
    {                                           \
      CASE_X_VAR (var, proc, __VA_ARGS__);      \
      CASE_W32_VAR (var, proc, __VA_ARGS__);    \
      CASE_NS_VAR (var, proc, __VA_ARGS__);     \
    }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]