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: Eli Zaretskii
Subject: Re: Renaming non-X x_* procedures in xdisp.c (and elsewhere)
Date: Sun, 24 Mar 2019 07:39:46 +0200
User-agent: K-9 Mail for Android

On March 24, 2019 6:50:45 AM GMT+02:00, Alex <address@hidden> wrote:
> 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__);     \
>     }

Where would something like that be needed?  Can you point out a couple of 
places in the code where we should use this?



reply via email to

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