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: Yuri Khan
Subject: Re: Renaming non-X x_* procedures in xdisp.c (and elsewhere)
Date: Sun, 24 Mar 2019 23:01:09 +0700

On Sun, Mar 24, 2019 at 10:07 PM Alex <address@hidden> wrote:

> This would be used wherever some generic procedure needed to call a
> windowing system-specific procedure.

Come on, this is a typical and solved design problem. The usual
solution is called polymorphism or virtual methods, does not require a
(macro-masked) switch statement at each call site, is quite possible
in C and not only OOP languages, and is used in Emacs in at least a
few places (terminals come to mind).

1: The generic part defines function pointer types for each
WS-specific function.
2: The generic part also defines a structure type whose members are of
function pointer types defined in step 1.
3: Each WS-specific part defines implementations for each WS-specific
function, with its own name prefix, following signatures defined in
step 1.
4: Each WS-specific part defines a global structure of type defined in
step 2 and fills it out with pointers to implementations defined in
step 3.
5: The structure defined in step 4 is either global (for a
single-windowing-system build) or gets passed around (for a
multiple-window-system build).



reply via email to

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