Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Confound these ancestors.... They've stolen our best ideas!" -- Ben Jonson


devel / comp.lang.c / Re: Help requested with P99-based macro to create Wayland listeners

SubjectAuthor
* Help requested with P99-based macro to create Wayland listenersBlue-Maned_Hawk
+* Re: Help requested with P99-based macro to create Wayland listenersTim Rentsch
|`* Re: Help requested with P99-based macro to create Wayland listenersBlue-Maned_Hawk
| `* Re: Help requested with P99-based macro to create Wayland listenersDavid Brown
|  `* Re: Help requested with P99-based macro to create Wayland listenersBlue-Maned_Hawk
|   +* Re: Help requested with P99-based macro to create Wayland listenersDavid Brown
|   |+* Re: Help requested with P99-based macro to create Wayland listenersScott Lurndal
|   ||`* Re: Help requested with P99-based macro to create Wayland listenersDavid Brown
|   || `* Re: Help requested with P99-based macro to create Wayland listenersChris M. Thomasson
|   ||  `* Re: Help requested with P99-based macro to create Wayland listenersDavid Brown
|   ||   +* Re: Help requested with P99-based macro to create Wayland listenersbart
|   ||   |`- Re: Help requested with P99-based macro to create Wayland listenersChris M. Thomasson
|   ||   `* Re: Help requested with P99-based macro to create Wayland listenersChris M. Thomasson
|   ||    `- Re: Help requested with P99-based macro to create Wayland listenersChris M. Thomasson
|   |`* Re: Help requested with P99-based macro to create Wayland listenersBen Bacarisse
|   | `* Re: Help requested with P99-based macro to create Wayland listenersTim Rentsch
|   |  `- Re: Help requested with P99-based macro to create Wayland listenersDavid Brown
|   `- Re: Help requested with P99-based macro to create Wayland listenersTim Rentsch
+* Re: Help requested with P99-based macro to create Wayland listenersJames Kuyper
|+- Re: Help requested with P99-based macro to create Wayland listenersBlue-Maned_Hawk
|+- Re: Help requested with P99-based macro to create Wayland listenersTim Rentsch
|`- Re: Help requested with P99-based macro to create Wayland listenersLawrence D'Oliveiro
`- Re: Help requested with P99-based macro to create Wayland listenersTim Rentsch

1
Help requested with P99-based macro to create Wayland listeners

<pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34977&group=comp.lang.c#34977

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Help requested with P99-based macro to create Wayland listeners
Date: Tue, 9 Apr 2024 00:36:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 09 Apr 2024 00:36:11 +0200 (CEST)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="24c6ffcb5da15c0ca183dd09cbb06a47";
logging-data="4013019"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18AmSLIK6GddUvEGgEiCr6VTlNPIfKZePY="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:i3jIfOR+h2+0UHEWYOBW8R/bPWk=
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
X-Face: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronuku
pokaiwhenuakitanatahu
 by: Blue-Maned_Hawk - Tue, 9 Apr 2024 00:36 UTC

This macro doesn't work and i don't know why. I've tried multiple
different things to try to delay the expansion of _0MAKE_LISTENER and none
of them have worked. I don't know if there's a more idiomatic way to do
this. I've tried looking at the output from putting it through ‘cpp’ and
that didn't work because it errored out before i could see what it
expanded to.

#define MAKE_LISTENER(object_type, ...) static const struct\
object_type##_listener object_type##_listener = { P99_SEQ(\
_0MAKE_LISTENER, P99_SEQ((object_type), __VA_ARGS__)) }
#define _0MAKE_LISTENER(x) _1MAKE_LISTENER (x, _2MAKE_LISTENER
#define _1MAKE_LISTENER _3MAKE_LISTENER
#define _2MAKE_LISTENER(y) y)
#define _3MAKE_LISTENER _4MAKE_LISTENER
#define _4MAKE_LISTENER(object_type, event_name) .event_name =\
callback_##object_type##_##event_name

--
Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
Like many 40-year-olds, these machines have more health issues than
expected.

Re: Help requested with P99-based macro to create Wayland listeners

<86ttka1p61.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34996&group=comp.lang.c#34996

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Tue, 09 Apr 2024 09:22:46 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <86ttka1p61.fsf@linuxsc.com>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Tue, 09 Apr 2024 16:22:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="47558c70f7e061adbec47d824d7ff660";
logging-data="357568"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sNQST51cm+PsX32UoXL7Pl6JD5y0Z8j4="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:ouCu+jNWh30QwYavks1nq6pR02g=
sha1:YZfn90K7ibo1+LuwgtkqzJWXbz0=
 by: Tim Rentsch - Tue, 9 Apr 2024 16:22 UTC

Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> writes:

> This macro doesn't work and i don't know why. I've tried multiple
> different things to try to delay the expansion of _0MAKE_LISTENER and none
> of them have worked. I don't know if there's a more idiomatic way to do
> this. I've tried looking at the output from putting it through ?cpp? and
> that didn't work because it errored out before i could see what it
> expanded to.
>
> #define MAKE_LISTENER(object_type, ...) static const struct\
> object_type##_listener object_type##_listener = { P99_SEQ(\
> _0MAKE_LISTENER, P99_SEQ((object_type), __VA_ARGS__)) }
> #define _0MAKE_LISTENER(x) _1MAKE_LISTENER (x, _2MAKE_LISTENER
> #define _1MAKE_LISTENER _3MAKE_LISTENER
> #define _2MAKE_LISTENER(y) y)
> #define _3MAKE_LISTENER _4MAKE_LISTENER
> #define _4MAKE_LISTENER(object_type, event_name) .event_name =\
> callback_##object_type##_##event_name

What is it that you want to accomplish?

Re: Help requested with P99-based macro to create Wayland listeners

<pan$325a1$29dc1a44$271afe6a$307a257b@invalid.invalid>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34997&group=comp.lang.c#34997

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Tue, 9 Apr 2024 18:17:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <pan$325a1$29dc1a44$271afe6a$307a257b@invalid.invalid>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
<86ttka1p61.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 09 Apr 2024 18:17:45 +0200 (CEST)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="f7086c78af08a8c2b236a056ff10835c";
logging-data="411895"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tw0WX/HlVeYKSPbczwe1EkSb6ghvT1qA="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:H0XHGy33tSkBbAhYxyhvtnAGLGE=
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
X-Face: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronuku
pokaiwhenuakitanatahu
 by: Blue-Maned_Hawk - Tue, 9 Apr 2024 18:17 UTC

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.

--
Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
Nothing's thoroughly disposed of until it's been through a digestive
system.

Re: Help requested with P99-based macro to create Wayland listeners

<uv46mg$e1e0$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=34999&group=comp.lang.c#34999

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Tue, 9 Apr 2024 21:59:12 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <uv46mg$e1e0$1@dont-email.me>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
<86ttka1p61.fsf@linuxsc.com>
<pan$325a1$29dc1a44$271afe6a$307a257b@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 09 Apr 2024 19:59:12 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0357aed96d9abf7bb9ca85360dd71e73";
logging-data="460224"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188EuqA/q8oWVQam02fgBj8rxSoQnWPfTU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:rUPSrizUh4XEIOtkzeSQsPbbr0g=
In-Reply-To: <pan$325a1$29dc1a44$271afe6a$307a257b@invalid.invalid>
Content-Language: en-GB
 by: David Brown - Tue, 9 Apr 2024 19:59 UTC

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.

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.

Re: Help requested with P99-based macro to create Wayland listeners

<pan$57aa8$bcee1756$62f53bf3$9223a50a@invalid.invalid>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35000&group=comp.lang.c#35000

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Tue, 9 Apr 2024 20:20:18 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <pan$57aa8$bcee1756$62f53bf3$9223a50a@invalid.invalid>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 09 Apr 2024 20:20:18 +0200 (CEST)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="f7086c78af08a8c2b236a056ff10835c";
logging-data="460321"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hYpuEiNirs9b94KTZxQUkd+cACIi1RlY="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:WvXHfftLaZUy/IouII0qMdygUy0=
X-Face: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronuku
pokaiwhenuakitanatahu
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
 by: Blue-Maned_Hawk - Tue, 9 Apr 2024 20:20 UTC

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 };

MAKE_LISTENER(xdg_wm_base, configure, close, configure_bounds,
wm_capabilities);

static const struct xdg_wm_base_listener xdg_wm_base_listener =
{ .configure = callback_xdg_wm_base_configure, .close =
callback_xdg_wm_base_close, .configure_bounds =
callback_xdg_wm_base_configure_bounds, .wm_capabilities =
callback_xdg_wm_base_wm_capabilities };

--
Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
Eating carpets strictly prohibited!

Re: Help requested with P99-based macro to create Wayland listeners

<uv5cov$q401$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35005&group=comp.lang.c#35005

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 02:49:03 -0400
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <uv5cov$q401$1@dont-email.me>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 06:49:04 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f3750c68072f1d140c67c0700c16d53d";
logging-data="856065"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xs0R+K1vqBlbM7S8lPTDurArQ6KusEd0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:+huJ0XMDFndJ8NxINw7IBUuV9rY=
Content-Language: en-US
In-Reply-To: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
 by: James Kuyper - Wed, 10 Apr 2024 06:49 UTC

On 4/8/24 20:36, Blue-Maned_Hawk wrote:
> This macro doesn't work and i don't know why. I've tried multiple
> different things to try to delay the expansion of _0MAKE_LISTENER and none
> of them have worked. I don't know if there's a more idiomatic way to do
> this. I've tried looking at the output from putting it through ‘cpp’ and
> that didn't work because it errored out before i could see what it
> expanded to.
>
> #define MAKE_LISTENER(object_type, ...) static const struct\
> object_type##_listener object_type##_listener = { P99_SEQ(\

This isn't a C problem, or at least,not entirely a C problem. I'd
thought that the P99 in your subject line might be a typo for C99, but I
have no idea what P99_SEQ is. Wikipedia knows 9 different meanings for
P99. Google gives me way too many hits from P99, I have no idea which
one is relevant. You might need to take this up with someone who has
some idea what P99 is.

The basic technique for delaying expansion is as follows:

#define STR(e) #e
#define STRSTR(e) STR(e)

and then replace WHATEVER with STRSTR(WHATEVER).

There are, I understand, good reasons based upon how macro expansion
works why this solution is necessary, but even when I was a lot younger
I had trouble understanding those reasons. I generally had to rely upon
trial and error to figure out the right way to use STRSTR().

Re: Help requested with P99-based macro to create Wayland listeners

<uv5kpk$s1fr$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35008&group=comp.lang.c#35008

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 11:05:55 +0200
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <uv5kpk$s1fr$1@dont-email.me>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 09:05:56 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7a89ab18d1e4b124320c42cc3e6d2a2d";
logging-data="919035"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4zZqZZN2fpR5b64X6gMXNPCLYdV4H6Bo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:YXQQdVBSBTXipiKfasiik6bqJ5s=
In-Reply-To: <pan$57aa8$bcee1756$62f53bf3$9223a50a@invalid.invalid>
Content-Language: en-GB
 by: David Brown - Wed, 10 Apr 2024 09:05 UTC

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
#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__) \
}

Re: Help requested with P99-based macro to create Wayland listeners

<pan$89fbc$b63a7794$5717b5cd$5e364f4@invalid.invalid>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35012&group=comp.lang.c#35012

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bluemanedhawk.eternal-september.org!.POSTED!not-for-mail
From: bluemane...@invalid.invalid (Blue-Maned_Hawk)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 13:57:48 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <pan$89fbc$b63a7794$5717b5cd$5e364f4@invalid.invalid>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
<uv5cov$q401$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 13:57:49 +0200 (CEST)
Injection-Info: bluemanedhawk.eternal-september.org; posting-host="9687a4ed2dea2605983202e326d72827";
logging-data="1056732"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196XG8mTDiXngYNWwuolFcoV+YUjOT8Li0="
User-Agent: Pan/0.154 (Izium; 517acf4)
Cancel-Lock: sha1:65aHs/MI6RmmgysPfW2+MAXnwr0=
X-Face: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronuku
pokaiwhenuakitanatahu
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACh0lEQVRYw71Z21bD
MAzzevbfkr4cHjrSXJyL044+MDa6WLEl2SkvkrZ1AbAvXO+bUGSCPYnsuIVGMpm
ZLnjX718GhAKNsp8lON2F9VrhELwIgJlBepkZjA78rVK+FkmNhEJK76UsJlz8+E
rJsjrpYouhLo/SC6qPHgakFOR8wV9+8rCfO/I/oVnmUZUp42/LW2XkLj9TCFNM9
jp5g2EmHZgpYZjCOkYU7sXVogRylJqpdggoFLG1g09Flah/7kErCxzR9HgXPYsq
0glb9cxjIz2Vsk9AmAoCSxECpD713joMKjQqLAtmMqJmXjdVvlMnMQCVITotJd1
z+fh1f1NNo+vuc1KnhWUmY7t03vydTud9BbXCtN3L2PL3bK7JCNG0GHzuZxafyB
fxevCxpm1vrwZltqw6SILCcdoCE6PGQC8wZWDA9Or7Qp5s3lAZezys0nDazs9S9
R0TjwEiksRxLkNPC1NMMWPs1bj0Ei0Yuo+JVtFLuzP1NRJ16qXWN8DhhtmS4PDg
O6mqRxs4bEJrYt087mSIow/1VzW2oFlMQuiuIy/KsUagvhdw6hSjJGlIavbLF8x
j3X47bccLcUSi0dkWh1nUZNhANT1tHKUXrNxNLbd9KPb9wDDVrKwmPQMOPQ1oy6
k5I1DwzDeRJd3jVIhDAUxq3ngzJG4CCkNXZxZVMcjefoK2J0gUY2S3rxz/RuTFx
2zHd9U+obimJXMG4edsk/2j5pTU5G1MmzbRLxkfq5EiT1GGsidvMGzi+1goGb2l
GCrN+nGnV8xj3q3JLRDVPL96vUc7Z4aJ3TN1mVqWAMJMfG+Jxh6TQqP+92iZkCU
xtglds1AB6r0aiSHKcnFck+p/c/0CbacFLQcajGcAAAAASUVORK5CYII=
 by: Blue-Maned_Hawk - Wed, 10 Apr 2024 13:57 UTC

James Kuyper wrote:

> This isn't a C problem, or at least,not entirely a C problem. I'd
> thought that the P99 in your subject line might be a typo for C99, but I
> have no idea what P99_SEQ is. Wikipedia knows 9 different meanings for
> P99. Google gives me way too many hits from P99, I have no idea which
> one is relevant. You might need to take this up with someone who has
> some idea what P99 is.

This is the P99 that i am referring to: <https://
gustedt.gitlabpages.inria.fr/p99/p99-html/index.html>.

--
Blue-Maned_Hawk│shortens to Hawk│/blu.mɛin.dʰak/│he/him/his/himself/Mr.
blue-maned_hawk.srht.site
Indisputably a ring!

Re: Help requested with P99-based macro to create Wayland listeners

<9kxRN.169894$t8cc.141699@fx06.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35014&group=comp.lang.c#35014

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx06.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Newsgroups: comp.lang.c
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>
Lines: 57
Message-ID: <9kxRN.169894$t8cc.141699@fx06.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 10 Apr 2024 14:26:13 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 10 Apr 2024 14:26:13 GMT
X-Received-Bytes: 3039
 by: Scott Lurndal - Wed, 10 Apr 2024 14:26 UTC

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
>#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__) \
> }
>

Frankly I'd reject that code in any code review request.

Re: Help requested with P99-based macro to create Wayland listeners

<87r0fdqnmi.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35016&group=comp.lang.c#35016

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
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
 by: Ben Bacarisse - Wed, 10 Apr 2024 14:49 UTC

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.

Re: Help requested with P99-based macro to create Wayland listeners

<uv696j$1108s$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35017&group=comp.lang.c#35017

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 16:54:11 +0200
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <uv696j$1108s$1@dont-email.me>
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> <9kxRN.169894$t8cc.141699@fx06.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 14:54:11 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7a89ab18d1e4b124320c42cc3e6d2a2d";
logging-data="1081628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Uw2MV1SqV1KGAj4hApedAZC6jli2usQE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:yUhAGlVsmgesyuebodfRGa1w1eU=
Content-Language: en-GB
In-Reply-To: <9kxRN.169894$t8cc.141699@fx06.iad>
 by: David Brown - Wed, 10 Apr 2024 14:54 UTC

On 10/04/2024 16:26, Scott Lurndal wrote:
> 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
>> #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__) \
>> }
>>
>
> Frankly I'd reject that code in any code review request.

I normally like code to be so clear that comments about how it works are
unnecessary. But I think for something like this, a few comments would
be helpful!

When doing this kind of messing around with advanced preprocessing, it's
useful to have a set of re-usable macros that can be written and
documented once. The "expand_macro_for_each" macro and its parts is
partly there, and once that is in place and accepted, the rest is a lot
smaller step to accept in a code review.

But this is code to help the OP get his macro generations working.
Whether he likes it, rejects it, or uses it for inspiration is up to him.

Re: Help requested with P99-based macro to create Wayland listeners

<86plux19y8.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35018&group=comp.lang.c#35018

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED.mailhub.linuxsc.com!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 09:03:43 -0700
Organization: A noiseless patient Spider
Message-ID: <86plux19y8.fsf@linuxsc.com>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="mailhub.linuxsc.com:45.79.96.183";
logging-data="1120477"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:1GjH+i5LEGofkFXqfJ1Fi/XVWbU=
 by: Tim Rentsch - Wed, 10 Apr 2024 16:03 UTC

Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> writes:

[request for example]

> 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
> };
>
> ?
>
> MAKE_LISTENER(xdg_wm_base, configure, close, configure_bounds,
> wm_capabilities);
>
> ?
>
> static const struct xdg_wm_base_listener xdg_wm_base_listener = {
> .configure = callback_xdg_wm_base_configure,
> .close = callback_xdg_wm_base_close,
> .configure_bounds = callback_xdg_wm_base_configure_bounds,
> .wm_capabilities = callback_xdg_wm_base_wm_capabilities
> };

I think it isn't too hard to write a macro to do what you
want. I'm pretty sure it's possible to define such a macro
using the P99 macros to do the iteration, but I don't see
an easy way to do it. If I were in need of such a macro,
probably I would ignore the P99 macros and just build a
simpler solution that works for the task at hand.

Re: Help requested with P99-based macro to create Wayland listeners

<86le5l19ur.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35019&group=comp.lang.c#35019

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED.mailhub.linuxsc.com!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 09:05:48 -0700
Organization: A noiseless patient Spider
Message-ID: <86le5l19ur.fsf@linuxsc.com>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid> <uv5cov$q401$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="mailhub.linuxsc.com:45.79.96.183";
logging-data="1120477"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:TXBW2pvJ5Ic6I6srJO/oZ6ey8+E=
 by: Tim Rentsch - Wed, 10 Apr 2024 16:05 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> writes:

> On 4/8/24 20:36, Blue-Maned_Hawk wrote:
>
>> This macro doesn't work and i don't know why. I've tried multiple
>> different things to try to delay the expansion of _0MAKE_LISTENER and none
>> of them have worked. I don't know if there's a more idiomatic way to do
>> this. I've tried looking at the output from putting it through ?cpp? and
>> that didn't work because it errored out before i could see what it
>> expanded to.
>>
>> #define MAKE_LISTENER(object_type, ...) static const struct\
>> object_type##_listener object_type##_listener = { P99_SEQ(\
>
> This isn't a C problem, or at least,not entirely a C problem. I'd
> thought that the P99 in your subject line might be a typo for C99, but I
> have no idea what P99_SEQ is. Wikipedia knows 9 different meanings for
> P99. [...]

Someone might tell James that it is entirely a C problem for
anyone with enough sense to search for P99_SEQ rather than
just P99.

Re: Help requested with P99-based macro to create Wayland listeners

<86h6g919py.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35020&group=comp.lang.c#35020

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED.mailhub.linuxsc.com!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 09:08:41 -0700
Organization: A noiseless patient Spider
Message-ID: <86h6g919py.fsf@linuxsc.com>
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> <87r0fdqnmi.fsf@bsb.me.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="mailhub.linuxsc.com:45.79.96.183";
logging-data="1120477"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:lQ57W6Y2X065L5BnrFG/tlCDDP0=
 by: Tim Rentsch - Wed, 10 Apr 2024 16:08 UTC

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> 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/

The bigger problem is that the proposed solution doesn't work
for more than five fields. Clearly the idea is to define a
macro that works for an unlimited number of fields, or at least
a fairly large number.

Re: Help requested with P99-based macro to create Wayland listeners

<uv6fec$12hjm$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35021&group=comp.lang.c#35021

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED.247.92-221-34.customer.lyse.net!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 18:40:44 +0200
Organization: A noiseless patient Spider
Message-ID: <uv6fec$12hjm$1@dont-email.me>
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> <87r0fdqnmi.fsf@bsb.me.uk>
<86h6g919py.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 10 Apr 2024 16:40:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="247.92-221-34.customer.lyse.net:92.221.34.247";
logging-data="1132150"; mail-complaints-to="abuse@eternal-september.org"
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <86h6g919py.fsf@linuxsc.com>
 by: David Brown - Wed, 10 Apr 2024 16:40 UTC

On 10/04/2024 18:08, Tim Rentsch wrote:
> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>
>> 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/

Correct - sorry about the typo.

>
> The bigger problem is that the proposed solution doesn't work
> for more than five fields.

I have no idea how many fields the OP might want, in order to judge if
that is a big problem or not. But I believe he'll be able to figure out
how to extend it as necessary.

> Clearly the idea is to define a
> macro that works for an unlimited number of fields, or at least
> a fairly large number.

If you have a way to extend it to unlimited numbers of fields, I would
love to know - as far as I am aware, the lack of recursion or loops in
the C pre-processor means that you always have to be limited like this.
It is, I think, possible to make sequence of macros like this that split
lists in half, so that you only need O(log N) submacros in order to
support up to N arguments. That would let you get to the level of very
large numbers pretty quickly.

Re: Help requested with P99-based macro to create Wayland listeners

<uv6mna$14d6r$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35025&group=comp.lang.c#35025

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 11:44:58 -0700
Organization: A noiseless patient Spider
Lines: 82
Message-ID: <uv6mna$14d6r$1@dont-email.me>
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> <9kxRN.169894$t8cc.141699@fx06.iad>
<uv696j$1108s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 20:44:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1e0154287d270c974cd6798ddf950547";
logging-data="1193179"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QOqp2kRI2ibzRPs7N+8/AKzsXleCe1Hw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:pEPmvzVY0/H/Co22IYRcgmarT2A=
In-Reply-To: <uv696j$1108s$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 10 Apr 2024 18:44 UTC

On 4/10/2024 7:54 AM, David Brown wrote:
> On 10/04/2024 16:26, Scott Lurndal wrote:
>> 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
>>> #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__) \
>>>      }
>>>
>>
>> Frankly I'd reject that code in any code review request.
>
> I normally like code to be so clear that comments about how it works are
> unnecessary.  But I think for something like this, a few comments would
> be helpful!
>
> When doing this kind of messing around with advanced preprocessing, it's
> useful to have a set of re-usable macros that can be written and
> documented once.  The "expand_macro_for_each" macro and its parts is
> partly there, and once that is in place and accepted, the rest is a lot
> smaller step to accept in a code review.
>
> But this is code to help the OP get his macro generations working.
> Whether he likes it, rejects it, or uses it for inspiration is up to him.
>
>

The OP needs a deep read of the chaos lib:

https://github.com/rofl0r/chaos-pp

Might help... ? ;^)

Re: Help requested with P99-based macro to create Wayland listeners

<uv6pa4$1501p$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35027&group=comp.lang.c#35027

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 21:29:08 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <uv6pa4$1501p$1@dont-email.me>
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> <9kxRN.169894$t8cc.141699@fx06.iad>
<uv696j$1108s$1@dont-email.me> <uv6mna$14d6r$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 10 Apr 2024 21:29:08 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="628edf322d9c309c452a7d41af268394";
logging-data="1212473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LmmRWcdJZWrGJcNYQXdmPn3SUCL94jT8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:WN4ShNomIuucM7ZouqafnnXF3cw=
Content-Language: en-GB
In-Reply-To: <uv6mna$14d6r$1@dont-email.me>
 by: David Brown - Wed, 10 Apr 2024 19:29 UTC

On 10/04/2024 20:44, Chris M. Thomasson wrote:

>
> The OP needs a deep read of the chaos lib:
>
> https://github.com/rofl0r/chaos-pp
>
> Might help... ? ;^)

I think more people would respond to your posts if you actually included
content, rather than just random links and smilies.

Assume that no one here will ever click on a youtube link - then you
clearly don't need to post them.

Assume that no one will click on any random webpage link, or even to
known sites like github, unless there's plenty of information in the
posts to make it clear why the linked software is relevant.

You do a lot of interesting programming, have interesting ideas, and are
energetic about sharing them and helping people. That's all great. But
you could do so much better at getting your thoughts across.

So if you don't mind - please try again. Tell us what "the chaos lib"
is. Say why it is exciting. Explain how it might help the OP, or
anyone else.

Re: Help requested with P99-based macro to create Wayland listeners

<uv6pu6$1585g$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35028&group=comp.lang.c#35028

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bc...@freeuk.com (bart)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 20:39:50 +0100
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <uv6pu6$1585g$1@dont-email.me>
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> <9kxRN.169894$t8cc.141699@fx06.iad>
<uv696j$1108s$1@dont-email.me> <uv6mna$14d6r$1@dont-email.me>
<uv6pa4$1501p$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 21:39:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="509425d4a7e19d9832405743df5292cc";
logging-data="1220784"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ta7NxmXNfMidvQMrZiyzU"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:0bx6aKz0iq9QG0hcaZLB359m8Bo=
In-Reply-To: <uv6pa4$1501p$1@dont-email.me>
Content-Language: en-GB
 by: bart - Wed, 10 Apr 2024 19:39 UTC

On 10/04/2024 20:29, David Brown wrote:
> On 10/04/2024 20:44, Chris M. Thomasson wrote:
>
>>
>> The OP needs a deep read of the chaos lib:
>>
>> https://github.com/rofl0r/chaos-pp
>>
>> Might help... ? ;^)
>
> I think more people would respond to your posts if you actually included
> content, rather than just random links and smilies.
>
> Assume that no one here will ever click on a youtube link - then you
> clearly don't need to post them.
>
> Assume that no one will click on any random webpage link, or even to
> known sites like github, unless there's plenty of information in the
> posts to make it clear why the linked software is relevant.
>
> You do a lot of interesting programming, have interesting ideas, and are
> energetic about sharing them and helping people.  That's all great.  But
> you could do so much better at getting your thoughts across.
>
> So if you don't mind - please try again.  Tell us what "the chaos lib"
> is.  Say why it is exciting.  Explain how it might help the OP, or
> anyone else.
>

I spent a few minutes looking at the link. I didn't learn anything. Just
loads of raw XML, XSL and HTML files. No explanation anywhere of what is
what.

The only two files in plaintext were LICENCE and README, both showing
licence info.

I've seen lots of github projects and this is poor. But then, I don't
know if this was ever meant to be seen like this; maybe it is just data
referenced by another project. Or you need special tools to view.

Re: Help requested with P99-based macro to create Wayland listeners

<uv6tgr$168hi$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35029&group=comp.lang.c#35029

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 13:40:59 -0700
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <uv6tgr$168hi$1@dont-email.me>
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> <9kxRN.169894$t8cc.141699@fx06.iad>
<uv696j$1108s$1@dont-email.me> <uv6mna$14d6r$1@dont-email.me>
<uv6pa4$1501p$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 22:40:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1e0154287d270c974cd6798ddf950547";
logging-data="1253938"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180g1/HQKm1O+sM5qdeZvrdQAVG5V+h0JY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:LcBdYvX9wEU8enSvJmXrFAH6x0w=
Content-Language: en-US
In-Reply-To: <uv6pa4$1501p$1@dont-email.me>
 by: Chris M. Thomasson - Wed, 10 Apr 2024 20:40 UTC

On 4/10/2024 12:29 PM, David Brown wrote:
> On 10/04/2024 20:44, Chris M. Thomasson wrote:
>
>>
>> The OP needs a deep read of the chaos lib:
>>
>> https://github.com/rofl0r/chaos-pp
>>
>> Might help... ? ;^)
>
> I think more people would respond to your posts if you actually included
> content, rather than just random links and smilies.
>
> Assume that no one here will ever click on a youtube link - then you
> clearly don't need to post them.
>
> Assume that no one will click on any random webpage link, or even to
> known sites like github, unless there's plenty of information in the
> posts to make it clear why the linked software is relevant.
>
> You do a lot of interesting programming, have interesting ideas, and are
> energetic about sharing them and helping people.  That's all great.  But
> you could do so much better at getting your thoughts across.
>
> So if you don't mind - please try again.  Tell us what "the chaos lib"
> is.  Say why it is exciting.  Explain how it might help the OP, or
> anyone else.
>

It is a preprocessor library with a lot of interesting fancy macros.
Iirc, the chaos preprocessor library is used in Boost.

Re: Help requested with P99-based macro to create Wayland listeners

<uv6tvj$16c5o$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35030&group=comp.lang.c#35030

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 13:48:51 -0700
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <uv6tvj$16c5o$1@dont-email.me>
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> <9kxRN.169894$t8cc.141699@fx06.iad>
<uv696j$1108s$1@dont-email.me> <uv6mna$14d6r$1@dont-email.me>
<uv6pa4$1501p$1@dont-email.me> <uv6tgr$168hi$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 22:48:52 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1e0154287d270c974cd6798ddf950547";
logging-data="1257656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EMFAoifclK8wn9rokZPCjDSKLsjaHPbM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:0c3vjya55qspWq0prD8O3EfEO0w=
In-Reply-To: <uv6tgr$168hi$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 10 Apr 2024 20:48 UTC

On 4/10/2024 1:40 PM, Chris M. Thomasson wrote:
> On 4/10/2024 12:29 PM, David Brown wrote:
>> On 10/04/2024 20:44, Chris M. Thomasson wrote:
>>
>>>
>>> The OP needs a deep read of the chaos lib:
>>>
>>> https://github.com/rofl0r/chaos-pp
>>>
>>> Might help... ? ;^)
>>
>> I think more people would respond to your posts if you actually
>> included content, rather than just random links and smilies.
>>
>> Assume that no one here will ever click on a youtube link - then you
>> clearly don't need to post them.
>>
>> Assume that no one will click on any random webpage link, or even to
>> known sites like github, unless there's plenty of information in the
>> posts to make it clear why the linked software is relevant.
>>
>> You do a lot of interesting programming, have interesting ideas, and
>> are energetic about sharing them and helping people.  That's all
>> great.  But you could do so much better at getting your thoughts across.
>>
>> So if you don't mind - please try again.  Tell us what "the chaos lib"
>> is.  Say why it is exciting.  Explain how it might help the OP, or
>> anyone else.
>>
>
> It is a preprocessor library with a lot of interesting fancy macros.
> Iirc, the chaos preprocessor library is used in Boost.

Yeah. Sigh. However, you can read some of the docs. A screenshot from my
end dealing with preprocessor arrays:

https://i.ibb.co/1rhBjCf/image.png

Another one dealing with so-called "active arguments":

https://i.ibb.co/vPTvdnP/image.png

I think Boost used to use or is based on chaos-pp wrt BOOST_PP_*

https://i.ibb.co/vPTvdnP/image.png

Re: Help requested with P99-based macro to create Wayland listeners

<uv6ubl$16he4$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35031&group=comp.lang.c#35031

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 13:55:17 -0700
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <uv6ubl$16he4$1@dont-email.me>
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> <9kxRN.169894$t8cc.141699@fx06.iad>
<uv696j$1108s$1@dont-email.me> <uv6mna$14d6r$1@dont-email.me>
<uv6pa4$1501p$1@dont-email.me> <uv6pu6$1585g$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 10 Apr 2024 22:55:17 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1e0154287d270c974cd6798ddf950547";
logging-data="1263044"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CyJrxdj4AijhdqoYmIGSV8dk8lWsIogM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:k89dNG32K8Fq0khf5AuCXVzEQzk=
In-Reply-To: <uv6pu6$1585g$1@dont-email.me>
Content-Language: en-US
 by: Chris M. Thomasson - Wed, 10 Apr 2024 20:55 UTC

On 4/10/2024 12:39 PM, bart wrote:
> On 10/04/2024 20:29, David Brown wrote:
>> On 10/04/2024 20:44, Chris M. Thomasson wrote:
>>
>>>
>>> The OP needs a deep read of the chaos lib:
>>>
>>> https://github.com/rofl0r/chaos-pp
[...]
> I've seen lots of github projects and this is poor. But then, I don't
> know if this was ever meant to be seen like this; maybe it is just data
> referenced by another project. Or you need special tools to view.

I accidentally posted this followup to David Brown. Sorry!

Yeah. Sigh. However, you can read some of the docs. A screenshot from my
end dealing with preprocessor arrays:

https://i.ibb.co/1rhBjCf/image.png

Another one dealing with so-called "active arguments":

https://i.ibb.co/vPTvdnP/image.png

I think Boost used to use or is based on chaos-pp wrt BOOST_PP_*

https://i.ibb.co/vPTvdnP/image.png

Also, remember this old post Bart?

https://groups.google.com/g/comp.lang.c/c/LkaB9kxIzTE/m/VypqT2VRBgAJ

:^)

Re: Help requested with P99-based macro to create Wayland listeners

<uv7chd$19nsd$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35036&group=comp.lang.c#35036

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo...@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Thu, 11 Apr 2024 00:57:17 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uv7chd$19nsd$2@dont-email.me>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
<uv5cov$q401$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 11 Apr 2024 02:57:18 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d2a2395bdbcba38bc0f5ee97a1706bee";
logging-data="1367949"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Y8ztRURTaGgkIWF30PxhC"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:J2HukASHPDBMzBGKQsKqtgS7mx4=
 by: Lawrence D'Oliv - Thu, 11 Apr 2024 00:57 UTC

On Wed, 10 Apr 2024 02:49:03 -0400, James Kuyper wrote:

> There are, I understand, good reasons based upon how macro expansion
> works why this solution is necessary, but even when I was a lot younger
> I had trouble understanding those reasons.

String-based macros are like that. That’s why Lisp-style macros are a
better idea.

Re: Help requested with P99-based macro to create Wayland listeners

<864jc81uaj.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=35039&group=comp.lang.c#35039

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.lang.c
Subject: Re: Help requested with P99-based macro to create Wayland listeners
Date: Wed, 10 Apr 2024 19:56:36 -0700
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <864jc81uaj.fsf@linuxsc.com>
References: <pan$3770d$7f0531e6$76520fa1$2c09330e@invalid.invalid>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 11 Apr 2024 04:56:37 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="4fc11677c226a0b0f8fa3f2c2bcf5112";
logging-data="1540443"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Rcy6rPZVjw8TDuLRaDBqgm+d1/crF44U="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:TBlbyMF5WFzpeDO5oJ2KW75kFUk=
sha1:DF1s9H9jXqESy/TV6SxwDL3GU0g=
 by: Tim Rentsch - Thu, 11 Apr 2024 02:56 UTC

Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> writes:

> This macro doesn't work and i don't know why. I've tried multiple
> different things to try to delay the expansion of _0MAKE_LISTENER
> and none of them have worked. I don't know if there's a more
> idiomatic way to do this. I've tried looking at the output from
> putting it through ?cpp? and that didn't work because it errored
> out before i could see what it expanded to.
>
> #define MAKE_LISTENER(object_type, ...) static const struct\
> object_type##_listener object_type##_listener = { P99_SEQ(\
> _0MAKE_LISTENER, P99_SEQ((object_type), __VA_ARGS__)) }
> #define _0MAKE_LISTENER(x) _1MAKE_LISTENER (x, _2MAKE_LISTENER
> #define _1MAKE_LISTENER _3MAKE_LISTENER
> #define _2MAKE_LISTENER(y) y)
> #define _3MAKE_LISTENER _4MAKE_LISTENER
> #define _4MAKE_LISTENER(object_type, event_name) .event_name =\
> callback_##object_type##_##event_name

After a lot of trial and error, I came up with the code below.
Probably it could be simplified, but I was happy just to get
it to work.

#include "p99.h"

#define static_const_LISTENER( kind, ... ) \
static const PLAIN_LISTENER( kind, __VA_ARGS__ )

#define PLAIN_LISTENER( kind, ... ) \
struct LISTENER_TAG_NAME( kind ) LISTENER_TAG_NAME( kind ) = { \
LISTENER_FIELDS( kind, __VA_ARGS__ ) \
}

#define LISTENER_TAG_NAME( kind ) JOIN2( kind, _listener )

#define LISTENER_FIELDS( kind, ... ) \
P99_SEQ( AS_IS, \
P99_SEQ( ONE_LISTENER_FIELD_2 AS_IS, \
P99_SEQ( ONE_LISTENER_FIELD, P99_SEQ( (kind), __VA_ARGS__ ) ) \
) \
)

#define ONE_LISTENER_FIELD( a ) ONE_LISTENER_FIELDx( a )
#define ONE_LISTENER_FIELDx( a ) SINGLES_INTO_PAIR( a )

#define SINGLES_INTO_PAIR( a_b ) ( ONE_COMMA_TWO a_b )
#define ONE_COMMA_TWO( a ) a, AS_IS

#define AS_IS( a ) a

#define ONE_LISTENER_FIELD_2( a, b ) ONE_LISTENER_FIELD_2x( a, b )
#define ONE_LISTENER_FIELD_2x( kind, field ) \
.field = callback_ ## kind ## _ ## field

#define JOIN2( a, b ) JOIN2x( a, b )
#define JOIN2x( a, b ) a ## b

static_const_LISTENER( wl_registry, global, global_remove );
static_const_LISTENER(
xdg_wm_base,
configure, close, configure_bounds, wm_capabilities
);

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor