Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <87r0fdqnmi.fsf@bsb.me.uk>
Deutsch   English   Français   Italiano  
<87r0fdqnmi.fsf@bsb.me.uk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 15:49:09 +0100
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <87r0fdqnmi.fsf@bsb.me.uk>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
	<86ttka1p61.fsf@linuxsc.com>
	<pan$325a1$29dc1a44$271afe6a$307a257b@invalid.invalid>
	<uv46mg$e1e0$1@dont-email.me>
	<pan$57aa8$bcee1756$62f53bf3$9223a50a@invalid.invalid>
	<uv5kpk$s1fr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 14:49:10 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="81e205f52c77617eb2daebc6e96cad4e";
	logging-data="1075421"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19kOlK7/GwLeuLFkp49gvYP7claYC6tPMw="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:vCWWb1QcAhG5+Q3j5UBOEpowaJQ=
	sha1:5lLPegqps+AYxKu+/7PfZg1EZVA=
X-BSB-Auth: 1.8b49be23bd594e77eb3d.20240410154910BST.87r0fdqnmi.fsf@bsb.me.uk
Bytes: 3439

David Brown <david.brown@hesbynett.no> writes:

> On 09/04/2024 22:20, Blue-Maned_Hawk wrote:
>> David Brown wrote:
>> 
>>> On 09/04/2024 20:17, Blue-Maned_Hawk wrote:
>>>> Tim Rentsch wrote:
>>>>
>>>>> What is it that you want to accomplish?
>>>>
>>>> As i stated in the subject line, i am trying to create a macro to
>>>> create Wayland listeners.
>>>>
>>>>
>>> Assume, for the sake of argument, that no one knows or cares anything
>>> about Wayland or listeners.
>> <https://xkcd.com/1432/>
>> 
>>> You are trying to use a set macros to expand to some code.  Start by
>>> showing what code you want to get from examples of using your macros -
>>> then people can try to help get the macros right.
>> MAKE_LISTENER(wl_registry, global, global_remove);
>> →
>> static const struct wl_registry_listener wl_registry_listener = { .global
>> = callback_wl_registry_global, .global_remove =
>> callback_wl_registry_global_remove };
>
> #define _get_6th_arg(_1, _2, _3, _4, _5, _arg, ...) _arg
> #define _fe_0(_global, _call, ...)
> #define _fe_1(_global, _call, x) _call(_global, x)
> #define _fe_2(_global, _call, x, ...) _call(_global, x) _fe_1(_global,
>  _call, __VA_ARGS__)
> #define _fe_3(_global, _call, x, ...) _call(_global, x) _fe_2(_global,
>  _call, __VA_ARGS__)
> #define _fe_4(_global, _call, x, ...) _call(_global, x) _fe_3(_global,
>  _call, __VA_ARGS__)
> #define expand_macro_for_each(_global, _macro, ...) \
>     _get_6th_arg("ignored", __VA_ARGS__, \
>     _fe_4, _fe_3, _fe_2, _fe_1, _fe_0)(_global, _macro, __VA_ARGS__)
>
>
> #define MAKE_LISTENER(object_type, ...) _make_listener(object_type,
>  __VA_ARGS__)
> #define _listener_entry(_global, _field) , . _field = callback_ ## _global
> ## _ ## field

s/field/_field/

> #define _make_listener(object_type, first_field, ...) static const struct \
>     object_type ## _listener object_type ## _listener = { \
>     .first_field = callback_ ## object_type ## _ ## first_field \
>     expand_macro_for_each(object_type, _listener_entry, __VA_ARGS__) \
>     }

-- 
Ben.