Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"Life sucks, but death doesn't put out at all...." -- Thomas J. Kopp


computers / comp.sys.apple2 / Why and wmTaskData4 ?

SubjectAuthor
* Why and wmTaskData4 ?Tom Thumb
+- Why and wmTaskData4 ?Tom Thumb
`* Why and wmTaskData4 ?Tom Thumb
 `* Why and wmTaskData4 ?stephen...@gmail.com
  `* Why and wmTaskData4 ?Tom Thumb
   `* Why and wmTaskData4 ?Tom Thumb
    +- Why and wmTaskData4 ?stephen...@gmail.com
    `* Why and wmTaskData4 ?Dirk Froehling
     `* Why and wmTaskData4 ?Tom Thumb
      `* Why and wmTaskData4 ?Tom Thumb
       +- Why and wmTaskData4 ?Jerry Penner
       `* Why and wmTaskData4 ?Dirk Froehling
        `- Why and wmTaskData4 ?Tom Thumb

1
Why and wmTaskData4 ?

<31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5353&group=comp.sys.apple2#5353

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:ac8:7f45:0:b0:3f6:c5c5:a6de with SMTP id g5-20020ac87f45000000b003f6c5c5a6demr1733763qtk.5.1685560649894;
Wed, 31 May 2023 12:17:29 -0700 (PDT)
X-Received: by 2002:a05:6214:5651:b0:623:8899:7d8a with SMTP id
mh17-20020a056214565100b0062388997d8amr986164qvb.7.1685560649710; Wed, 31 May
2023 12:17:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Wed, 31 May 2023 12:17:29 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2603:7000:a102:7200:38ec:10b9:80bb:3294;
posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 2603:7000:a102:7200:38ec:10b9:80bb:3294
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
Subject: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Wed, 31 May 2023 19:17:29 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Tom Thumb - Wed, 31 May 2023 19:17 UTC

Mike Westerfield's "Toolbox Programming in C" contains a routine:

void HandleControl (void)
{ if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
switch (myEvent.wmTaskData4) {

....

I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?

I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.

Re: Why and wmTaskData4 ?

<185f7bd5-3109-4d9f-9b14-5c20a5da9395n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5355&group=comp.sys.apple2#5355

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:ac8:58c9:0:b0:3f5:2790:9ebb with SMTP id u9-20020ac858c9000000b003f527909ebbmr2437957qta.0.1685636520735;
Thu, 01 Jun 2023 09:22:00 -0700 (PDT)
X-Received: by 2002:a05:620a:1726:b0:75c:b18b:712f with SMTP id
az38-20020a05620a172600b0075cb18b712fmr2856401qkb.7.1685636520541; Thu, 01
Jun 2023 09:22:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Thu, 1 Jun 2023 09:22:00 -0700 (PDT)
In-Reply-To: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:7000:a102:7200:209e:e32d:6880:3729;
posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 2603:7000:a102:7200:209e:e32d:6880:3729
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <185f7bd5-3109-4d9f-9b14-5c20a5da9395n@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Thu, 01 Jun 2023 16:22:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Tom Thumb - Thu, 1 Jun 2023 16:22 UTC

On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> Mike Westerfield's "Toolbox Programming in C" contains a routine:
>
> void HandleControl (void)
> {
> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> switch (myEvent.wmTaskData4) {
>
> ...
>
> I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
>
> I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.

Oh, it's checking if wmTaskData4 is 32768.

Re: Why and wmTaskData4 ?

<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5356&group=comp.sys.apple2#5356

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:622a:1d6:b0:3f6:83f0:c56a with SMTP id t22-20020a05622a01d600b003f683f0c56amr2790857qtw.6.1685636758911;
Thu, 01 Jun 2023 09:25:58 -0700 (PDT)
X-Received: by 2002:a05:622a:18a1:b0:3f6:ae6d:6c3d with SMTP id
v33-20020a05622a18a100b003f6ae6d6c3dmr2520306qtc.12.1685636414269; Thu, 01
Jun 2023 09:20:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Thu, 1 Jun 2023 09:20:14 -0700 (PDT)
In-Reply-To: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:7000:a102:7200:209e:e32d:6880:3729;
posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 2603:7000:a102:7200:209e:e32d:6880:3729
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Thu, 01 Jun 2023 16:25:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1868
 by: Tom Thumb - Thu, 1 Jun 2023 16:20 UTC

On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> Mike Westerfield's "Toolbox Programming in C" contains a routine:
>
> void HandleControl (void)
> {
> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> switch (myEvent.wmTaskData4) {
>
> ...
>
> I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
>
> I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.

Oh, it's checking to see if wmTaskData4 is less than 32768

Re: Why and wmTaskData4 ?

<6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5357&group=comp.sys.apple2#5357

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:622a:1654:b0:3f6:1f6e:b022 with SMTP id y20-20020a05622a165400b003f61f6eb022mr2928568qtj.3.1685642705432;
Thu, 01 Jun 2023 11:05:05 -0700 (PDT)
X-Received: by 2002:a05:620a:2807:b0:75b:36c4:c105 with SMTP id
f7-20020a05620a280700b0075b36c4c105mr2747410qkp.7.1685642705153; Thu, 01 Jun
2023 11:05:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Thu, 1 Jun 2023 11:05:04 -0700 (PDT)
In-Reply-To: <6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=73.51.196.74; posting-account=cvqNrwoAAADJiyw_4wkUXsHtt8VSEQSl
NNTP-Posting-Host: 73.51.196.74
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com> <6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: stephenheumann@gmail.com (stephen...@gmail.com)
Injection-Date: Thu, 01 Jun 2023 18:05:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2646
 by: stephen...@gmail.com - Thu, 1 Jun 2023 18:05 UTC

On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
> On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> > Mike Westerfield's "Toolbox Programming in C" contains a routine:
> >
> > void HandleControl (void)
> > {
> > if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> > switch (myEvent.wmTaskData4) {
> >
> > ...
> >
> > I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
> >
> > I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
> Oh, it's checking to see if wmTaskData4 is less than 32768

Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".

I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.

--
Stephen Heumann

Re: Why and wmTaskData4 ?

<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5358&group=comp.sys.apple2#5358

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:ad4:48c2:0:b0:626:2366:e4c7 with SMTP id v2-20020ad448c2000000b006262366e4c7mr1382412qvx.11.1685665987551;
Thu, 01 Jun 2023 17:33:07 -0700 (PDT)
X-Received: by 2002:a05:620a:c4d:b0:759:5d54:ee69 with SMTP id
u13-20020a05620a0c4d00b007595d54ee69mr2445705qki.1.1685665987313; Thu, 01 Jun
2023 17:33:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Thu, 1 Jun 2023 17:33:06 -0700 (PDT)
In-Reply-To: <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.185.98.244; posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 24.185.98.244
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com> <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Fri, 02 Jun 2023 00:33:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2882
 by: Tom Thumb - Fri, 2 Jun 2023 00:33 UTC

On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
> On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
> > On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> > > Mike Westerfield's "Toolbox Programming in C" contains a routine:
> > >
> > > void HandleControl (void)
> > > {
> > > if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> > > switch (myEvent.wmTaskData4) {
> > >
> > > ...
> > >
> > > I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
> > >
> > > I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
> > Oh, it's checking to see if wmTaskData4 is less than 32768
> Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768.. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".
>
> I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.
>
> --
> Stephen Heumann

Ahh, thank you very much.

Re: Why and wmTaskData4 ?

<907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5359&group=comp.sys.apple2#5359

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:620a:28d1:b0:75b:271b:8d1a with SMTP id l17-20020a05620a28d100b0075b271b8d1amr3705726qkp.3.1685726159464;
Fri, 02 Jun 2023 10:15:59 -0700 (PDT)
X-Received: by 2002:a05:620a:468f:b0:75c:9881:18fe with SMTP id
bq15-20020a05620a468f00b0075c988118femr3704403qkb.1.1685726159287; Fri, 02
Jun 2023 10:15:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Fri, 2 Jun 2023 10:15:58 -0700 (PDT)
In-Reply-To: <48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:7000:a102:7200:8d9:5177:c55:6005;
posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 2603:7000:a102:7200:8d9:5177:c55:6005
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com> <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Fri, 02 Jun 2023 17:15:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3312
 by: Tom Thumb - Fri, 2 Jun 2023 17:15 UTC

On Thursday, June 1, 2023 at 8:33:08 PM UTC-4, Tom Thumb wrote:
> On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
> > On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
> > > On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> > > > Mike Westerfield's "Toolbox Programming in C" contains a routine:
> > > >
> > > > void HandleControl (void)
> > > > {
> > > > if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> > > > switch (myEvent.wmTaskData4) {
> > > >
> > > > ...
> > > >
> > > > I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
> > > >
> > > > I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
> > > Oh, it's checking to see if wmTaskData4 is less than 32768
> > Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".
> >
> > I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.
> >
> > --
> > Stephen Heumann
> Ahh, thank you very much.

May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?

is there a reason? or just a choice?

Re: Why and wmTaskData4 ?

<57568bd1-b0b7-4199-ac99-64f8483e8713n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5360&group=comp.sys.apple2#5360

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:6214:14f3:b0:626:26ca:2306 with SMTP id k19-20020a05621414f300b0062626ca2306mr1995954qvw.9.1685735454328;
Fri, 02 Jun 2023 12:50:54 -0700 (PDT)
X-Received: by 2002:a05:622a:1d6:b0:3f6:83f0:c56a with SMTP id
t22-20020a05622a01d600b003f683f0c56amr3975198qtw.6.1685735454126; Fri, 02 Jun
2023 12:50:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Fri, 2 Jun 2023 12:50:53 -0700 (PDT)
In-Reply-To: <907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=73.51.196.74; posting-account=cvqNrwoAAADJiyw_4wkUXsHtt8VSEQSl
NNTP-Posting-Host: 73.51.196.74
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com> <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com> <907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <57568bd1-b0b7-4199-ac99-64f8483e8713n@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: stephenheumann@gmail.com (stephen...@gmail.com)
Injection-Date: Fri, 02 Jun 2023 19:50:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1945
 by: stephen...@gmail.com - Fri, 2 Jun 2023 19:50 UTC

On Friday, June 2, 2023 at 12:16:00 PM UTC-5, Tom Thumb wrote:

> May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?
>
> is there a reason? or just a choice?

That is probably also because of the translation from Pascal. Pascal doesn't really have unsigned integer types, so a value with the high bit set would be treated as a negative number. The bit-masking check excludes such numbers.

--
Stephen Heumann

Re: Why and wmTaskData4 ?

<kedrlfFsphbU1@mid.individual.net>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5367&group=comp.sys.apple2#5367

  copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: dirk.froehling@freenet.de (Dirk Froehling)
Newsgroups: comp.sys.apple2
Subject: Re: Why and wmTaskData4 ?
Date: Thu, 8 Jun 2023 13:17:02 +0200
Lines: 43
Message-ID: <kedrlfFsphbU1@mid.individual.net>
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com>
<6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com>
<907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net F1tQ3Ml5E0ntSefmqlypkAzi95cci8yhIhw0A+19BzSeSOTCJS
Cancel-Lock: sha1:IqC1CTu2ibqyZoy4s6PsVMxBP44=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.11.0
In-Reply-To: <907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
 by: Dirk Froehling - Thu, 8 Jun 2023 11:17 UTC

Am 02.06.23 um 19:15 schrieb Tom Thumb:
> On Thursday, June 1, 2023 at 8:33:08 PM UTC-4, Tom Thumb wrote:
>> On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
>>> On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
>>>> On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
>>>>> Mike Westerfield's "Toolbox Programming in C" contains a routine:
>>>>>
>>>>> void HandleControl (void)
>>>>> {
>>>>> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
>>>>> switch (myEvent.wmTaskData4) {
>>>>>
>>>>> ...
>>>>>
>>>>> I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
>>>>>
>>>>> I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
>>>> Oh, it's checking to see if wmTaskData4 is less than 32768
>>> Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".
>>>
>>> I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.
>>>
>>> --
>>> Stephen Heumann
>> Ahh, thank you very much.
>
> May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?
>
> is there a reason? or just a choice?
>

It is easier to read. :)

No, really. 32767 is meaningless in that context. wmTaskData4 contains a
bunch of seperate settings coded as bits, not a single number.

0xFFFF8000 is 1111 1111 1111 1111 1000 0000 0000 0000 in binary form,
and by ANDing wmTaskData4 with this number, you say "I am only
interested in the upper 17 bits, ignore the lower bits."
The IF condition then means "If none of the settings in the upper 17
bits is set, do the following."

Dirk

Re: Why and wmTaskData4 ?

<83c3c095-6b8d-41c3-be62-18b746df1865n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5368&group=comp.sys.apple2#5368

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:620a:40c3:b0:759:4381:d767 with SMTP id g3-20020a05620a40c300b007594381d767mr1907748qko.11.1686272360443;
Thu, 08 Jun 2023 17:59:20 -0700 (PDT)
X-Received: by 2002:ad4:5a4e:0:b0:626:2366:e4c7 with SMTP id
ej14-20020ad45a4e000000b006262366e4c7mr10931qvb.11.1686272360238; Thu, 08 Jun
2023 17:59:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Thu, 8 Jun 2023 17:59:19 -0700 (PDT)
In-Reply-To: <kedrlfFsphbU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=24.185.98.244; posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 24.185.98.244
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com> <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com> <907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
<kedrlfFsphbU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <83c3c095-6b8d-41c3-be62-18b746df1865n@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Fri, 09 Jun 2023 00:59:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4428
 by: Tom Thumb - Fri, 9 Jun 2023 00:59 UTC

On Thursday, June 8, 2023 at 7:17:06 AM UTC-4, Dirk Froehling wrote:
> Am 02.06.23 um 19:15 schrieb Tom Thumb:
> > On Thursday, June 1, 2023 at 8:33:08 PM UTC-4, Tom Thumb wrote:
> >> On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
> >>> On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
> >>>> On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> >>>>> Mike Westerfield's "Toolbox Programming in C" contains a routine:
> >>>>>
> >>>>> void HandleControl (void)
> >>>>> {
> >>>>> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> >>>>> switch (myEvent.wmTaskData4) {
> >>>>>
> >>>>> ...
> >>>>>
> >>>>> I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
> >>>>>
> >>>>> I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
> >>>> Oh, it's checking to see if wmTaskData4 is less than 32768
> >>> Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".
> >>>
> >>> I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.
> >>>
> >>> --
> >>> Stephen Heumann
> >> Ahh, thank you very much.
> >
> > May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?
> >
> > is there a reason? or just a choice?
> >
> It is easier to read. :)
>
> No, really. 32767 is meaningless in that context. wmTaskData4 contains a
> bunch of seperate settings coded as bits, not a single number.
>
> 0xFFFF8000 is 1111 1111 1111 1111 1000 0000 0000 0000 in binary form,
> and by ANDing wmTaskData4 with this number, you say "I am only
> interested in the upper 17 bits, ignore the lower bits."
> The IF condition then means "If none of the settings in the upper 17
> bits is set, do the following."
>
> Dirk

I get the ANDing to test if bits are set and that's what I thought first too but as far as I've read the only thing wmTaskData4 ever contains is a zero or a control id; it, wmTaskData4, isn't flags bits. Only after playing ANDing that I stumbled upon 00000000000000001111111111111111, 0x7FFF, 32768 triggers that condition <shrug>

Was just wondering why.

Re: Why and wmTaskData4 ?

<8e1ca05a-d49c-4e86-b5a4-1ff363940569n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5369&group=comp.sys.apple2#5369

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a05:620a:244d:b0:759:5252:c053 with SMTP id h13-20020a05620a244d00b007595252c053mr1887775qkn.1.1686272536059;
Thu, 08 Jun 2023 18:02:16 -0700 (PDT)
X-Received: by 2002:a05:620a:430a:b0:75c:9a12:8e61 with SMTP id
u10-20020a05620a430a00b0075c9a128e61mr1887547qko.8.1686272535892; Thu, 08 Jun
2023 18:02:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Thu, 8 Jun 2023 18:02:15 -0700 (PDT)
In-Reply-To: <83c3c095-6b8d-41c3-be62-18b746df1865n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.185.98.244; posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 24.185.98.244
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com> <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com> <907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
<kedrlfFsphbU1@mid.individual.net> <83c3c095-6b8d-41c3-be62-18b746df1865n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8e1ca05a-d49c-4e86-b5a4-1ff363940569n@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Fri, 09 Jun 2023 01:02:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Tom Thumb - Fri, 9 Jun 2023 01:02 UTC

On Thursday, June 8, 2023 at 8:59:21 PM UTC-4, Tom Thumb wrote:
> On Thursday, June 8, 2023 at 7:17:06 AM UTC-4, Dirk Froehling wrote:
> > Am 02.06.23 um 19:15 schrieb Tom Thumb:
> > > On Thursday, June 1, 2023 at 8:33:08 PM UTC-4, Tom Thumb wrote:
> > >> On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
> > >>> On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
> > >>>> On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> > >>>>> Mike Westerfield's "Toolbox Programming in C" contains a routine:
> > >>>>>
> > >>>>> void HandleControl (void)
> > >>>>> {
> > >>>>> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> > >>>>> switch (myEvent.wmTaskData4) {
> > >>>>>
> > >>>>> ...
> > >>>>>
> > >>>>> I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
> > >>>>>
> > >>>>> I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
> > >>>> Oh, it's checking to see if wmTaskData4 is less than 32768
> > >>> Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".
> > >>>
> > >>> I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.
> > >>>
> > >>> --
> > >>> Stephen Heumann
> > >> Ahh, thank you very much.
> > >
> > > May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?
> > >
> > > is there a reason? or just a choice?
> > >
> > It is easier to read. :)
> >
> > No, really. 32767 is meaningless in that context. wmTaskData4 contains a
> > bunch of seperate settings coded as bits, not a single number.
> >
> > 0xFFFF8000 is 1111 1111 1111 1111 1000 0000 0000 0000 in binary form,
> > and by ANDing wmTaskData4 with this number, you say "I am only
> > interested in the upper 17 bits, ignore the lower bits."
> > The IF condition then means "If none of the settings in the upper 17
> > bits is set, do the following."
> >
> > Dirk
> I get the ANDing to test if bits are set and that's what I thought first too but as far as I've read the only thing wmTaskData4 ever contains is a zero or a control id; it, wmTaskData4, isn't flags bits. Only after playing ANDing that I stumbled upon 00000000000000001111111111111111, 0x7FFF, 32768 triggers that condition <shrug>
>
> Was just wondering why.

He has a sense of humor. I think he was just messing with me.

Re: Why and wmTaskData4 ?

<yubjzwds5d1.fsf@jpen.ca>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5370&group=comp.sys.apple2#5370

  copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jerry+a2@jpen.ca (Jerry Penner)
Newsgroups: comp.sys.apple2
Subject: Re: Why and wmTaskData4 ?
Date: Thu, 08 Jun 2023 21:04:58 -0600
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <yubjzwds5d1.fsf@jpen.ca>
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com>
<6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com>
<907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
<kedrlfFsphbU1@mid.individual.net>
<83c3c095-6b8d-41c3-be62-18b746df1865n@googlegroups.com>
<8e1ca05a-d49c-4e86-b5a4-1ff363940569n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="a1416f335f78303ad688f38e3a527584";
logging-data="1905014"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XN5hLC+voSUAUcJUqkodf"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:Gnt1FMc+e9mr7Spnj9k9QIBa5Yg=
sha1:XcxWkhlFtFzR1pvSyhbm5sV/ZOU=
 by: Jerry Penner - Fri, 9 Jun 2023 03:04 UTC

Tom Thumb <justliketomsthumbsblues@gmail.com> writes:

> On Thursday, June 8, 2023 at 8:59:21 PM UTC-4, Tom Thumb wrote:
>> On Thursday, June 8, 2023 at 7:17:06 AM UTC-4, Dirk Froehling wrote:
>> > Am 02.06.23 um 19:15 schrieb Tom Thumb:
>> > > On Thursday, June 1, 2023 at 8:33:08 PM UTC-4, Tom Thumb wrote:
>> > >> On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
>> > >>> On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
>> > >>>> On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
>> > >>>>> Mike Westerfield's "Toolbox Programming in C" contains a routine:
>> > >>>>>
>> > >>>>> void HandleControl (void)
>> > >>>>> {
>> > >>>>> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
>> > >>>>> switch (myEvent.wmTaskData4) {
>> > >>>>>
>> > >>>>> ...
>> > >>>>>
>> > >>>>> I can find no explanation for doing this. I believe it's just testing if any of
>> > >>>>> the bits 17 - 31 have been set to one?
>> > >>>>>
>> > >>>>> I'd be grateful if someone would explain why this is being done. I imagine I've
>> > >>>>> missed something there or the IIgs Reference Manuals.
>> > >>>> Oh, it's checking to see if wmTaskData4 is less than 32768
>> > >>> Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all
>> > >>> the control IDs that the code wants to check for are less than 32768. The "if"
>> > >>> check is OK, but it's not really necessary, since the code could just check for
>> > >>> the control IDs of interest via the "switch".
>> > >>>
>> > >>> I suspect the "if" check is there because the code was originally written in
>> > >>> Pascal for the Toolbox Programming in Pascal course and then later translated to
>> > >>> C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making
>> > >>> a check like this necessary, but the "switch" statement in C does not have the
>> > >>> same limitation.
>> > >>>
>> > >>> --
>> > >>> Stephen Heumann
>> > >> Ahh, thank you very much.
>> > >
>> > > May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000)
>> > > == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?
>> > >
>> > > is there a reason? or just a choice?
>> > >
>> > It is easier to read. :)
>> >
>> > No, really. 32767 is meaningless in that context. wmTaskData4 contains a
>> > bunch of seperate settings coded as bits, not a single number.
>> >
>> > 0xFFFF8000 is 1111 1111 1111 1111 1000 0000 0000 0000 in binary form,
>> > and by ANDing wmTaskData4 with this number, you say "I am only
>> > interested in the upper 17 bits, ignore the lower bits."
>> > The IF condition then means "If none of the settings in the upper 17
>> > bits is set, do the following."
>> >
>> > Dirk
>> I get the ANDing to test if bits are set and that's what I thought first too but as far
>> as I've read the only thing wmTaskData4 ever contains is a zero or a control id; it,
>> wmTaskData4, isn't flags bits. Only after playing ANDing that I stumbled upon
>> 00000000000000001111111111111111, 0x7FFF, 32768 triggers that condition <shrug>
>>
>> Was just wondering why.
>
> He has a sense of humor. I think he was just messing with me.

Hmmm, I don't think he was messing with you. The hex-style is a fairly
typical way to handle stuff like this. It's common in microcontroller
code.

--
--
Jerry jerry+a2 at jpen.ca

Re: Why and wmTaskData4 ?

<kefvakF7uapU1@mid.individual.net>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5371&group=comp.sys.apple2#5371

  copy link   Newsgroups: comp.sys.apple2
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: dirk.froehling@freenet.de (Dirk Froehling)
Newsgroups: comp.sys.apple2
Subject: Re: Why and wmTaskData4 ?
Date: Fri, 9 Jun 2023 08:31:48 +0200
Lines: 70
Message-ID: <kefvakF7uapU1@mid.individual.net>
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com>
<6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com>
<907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
<kedrlfFsphbU1@mid.individual.net>
<83c3c095-6b8d-41c3-be62-18b746df1865n@googlegroups.com>
<8e1ca05a-d49c-4e86-b5a4-1ff363940569n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net fvkruKgH2UtpcfoN+pyvogRswuXAGxCtffnCnkbHhB8ex2k2qH
Cancel-Lock: sha1:hx6QSxlopofb1dCrsrnyI0recAE=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.11.0
In-Reply-To: <8e1ca05a-d49c-4e86-b5a4-1ff363940569n@googlegroups.com>
 by: Dirk Froehling - Fri, 9 Jun 2023 06:31 UTC

Am 09.06.23 um 03:02 schrieb Tom Thumb:
> On Thursday, June 8, 2023 at 8:59:21 PM UTC-4, Tom Thumb wrote:
>> On Thursday, June 8, 2023 at 7:17:06 AM UTC-4, Dirk Froehling wrote:
>>> Am 02.06.23 um 19:15 schrieb Tom Thumb:
>>>> On Thursday, June 1, 2023 at 8:33:08 PM UTC-4, Tom Thumb wrote:
>>>>> On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
>>>>>> On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
>>>>>>> On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
>>>>>>>> Mike Westerfield's "Toolbox Programming in C" contains a routine:
>>>>>>>>
>>>>>>>> void HandleControl (void)
>>>>>>>> {
>>>>>>>> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
>>>>>>>> switch (myEvent.wmTaskData4) {
>>>>>>>>
>>>>>>>> ...
>>>>>>>>
>>>>>>>> I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
>>>>>>>>
>>>>>>>> I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
>>>>>>> Oh, it's checking to see if wmTaskData4 is less than 32768
>>>>>> Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".
>>>>>>
>>>>>> I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.
>>>>>>
>>>>>> --
>>>>>> Stephen Heumann
>>>>> Ahh, thank you very much.
>>>>
>>>> May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?
>>>>
>>>> is there a reason? or just a choice?
>>>>
>>> It is easier to read. :)
>>>
>>> No, really. 32767 is meaningless in that context. wmTaskData4 contains a
>>> bunch of seperate settings coded as bits, not a single number.
>>>
>>> 0xFFFF8000 is 1111 1111 1111 1111 1000 0000 0000 0000 in binary form,
>>> and by ANDing wmTaskData4 with this number, you say "I am only
>>> interested in the upper 17 bits, ignore the lower bits."
>>> The IF condition then means "If none of the settings in the upper 17
>>> bits is set, do the following."
>>>
>>> Dirk
>> I get the ANDing to test if bits are set and that's what I thought first too but as far as I've read the only thing wmTaskData4 ever contains is a zero or a control id; it, wmTaskData4, isn't flags bits. Only after playing ANDing that I stumbled upon 00000000000000001111111111111111, 0x7FFF, 32768 triggers that condition <shrug>
>>
>> Was just wondering why.
>
> He has a sense of humor. I think he was just messing with me.

I have to admit that I didn't really check what kind of values
wmTaskData4 can contain. You and Stephen are correct, it should contain
the ID of a control in your dialog.

But maybe it contains other things in certain conditions. Otherwise that
check would not be needed (if you only have controls with small ID
numbers). If the event handling is done for a modeless dialog, for
example, it would be useful to ignore all unknown events.

I just tried to explain the hex form in the statement. You don't need to
play with values to find out the meaning if you write a constant that
way. It is like a mask for specific bits.

No, I don't have a sense of humor.

;)

Dirk

Re: Why and wmTaskData4 ?

<498bc785-03c9-478a-8792-4ef57bdc4dd9n@googlegroups.com>

  copy mid

https://news.novabbs.org/computers/article-flat.php?id=5372&group=comp.sys.apple2#5372

  copy link   Newsgroups: comp.sys.apple2
X-Received: by 2002:a37:38b:0:b0:75b:2611:8b62 with SMTP id 133-20020a37038b000000b0075b26118b62mr222862qkd.15.1686313901128;
Fri, 09 Jun 2023 05:31:41 -0700 (PDT)
X-Received: by 2002:a37:756:0:b0:759:46e0:1471 with SMTP id
83-20020a370756000000b0075946e01471mr95171qkh.2.1686313900927; Fri, 09 Jun
2023 05:31:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2
Date: Fri, 9 Jun 2023 05:31:40 -0700 (PDT)
In-Reply-To: <kefvakF7uapU1@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=24.185.98.244; posting-account=PB2qngoAAACRVoANRzBDZM-TqC_DJF8g
NNTP-Posting-Host: 24.185.98.244
References: <31aedcd1-5cd7-4f83-9df4-569fcc7d4402n@googlegroups.com>
<6b5294b3-23e4-46b1-891c-f8a300a7ca83n@googlegroups.com> <6f050e3e-c3b2-4956-932d-d7eff13d56e9n@googlegroups.com>
<48ded5a6-4fe6-458e-a1b3-292874687c5dn@googlegroups.com> <907103c5-da23-4f9b-a2d2-2a8665b4d27an@googlegroups.com>
<kedrlfFsphbU1@mid.individual.net> <83c3c095-6b8d-41c3-be62-18b746df1865n@googlegroups.com>
<8e1ca05a-d49c-4e86-b5a4-1ff363940569n@googlegroups.com> <kefvakF7uapU1@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <498bc785-03c9-478a-8792-4ef57bdc4dd9n@googlegroups.com>
Subject: Re: Why and wmTaskData4 ?
From: justliketomsthumbsblues@gmail.com (Tom Thumb)
Injection-Date: Fri, 09 Jun 2023 12:31:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 6440
 by: Tom Thumb - Fri, 9 Jun 2023 12:31 UTC

On Friday, June 9, 2023 at 2:31:51 AM UTC-4, Dirk Froehling wrote:
> Am 09.06.23 um 03:02 schrieb Tom Thumb:
> > On Thursday, June 8, 2023 at 8:59:21 PM UTC-4, Tom Thumb wrote:
> >> On Thursday, June 8, 2023 at 7:17:06 AM UTC-4, Dirk Froehling wrote:
> >>> Am 02.06.23 um 19:15 schrieb Tom Thumb:
> >>>> On Thursday, June 1, 2023 at 8:33:08 PM UTC-4, Tom Thumb wrote:
> >>>>> On Thursday, June 1, 2023 at 2:05:06 PM UTC-4, stephen...@gmail.com wrote:
> >>>>>> On Thursday, June 1, 2023 at 11:25:59 AM UTC-5, Tom Thumb wrote:
> >>>>>>> On Wednesday, May 31, 2023 at 3:17:30 PM UTC-4, Tom Thumb wrote:
> >>>>>>>> Mike Westerfield's "Toolbox Programming in C" contains a routine:
> >>>>>>>>
> >>>>>>>> void HandleControl (void)
> >>>>>>>> {
> >>>>>>>> if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0)
> >>>>>>>> switch (myEvent.wmTaskData4) {
> >>>>>>>>
> >>>>>>>> ...
> >>>>>>>>
> >>>>>>>> I can find no explanation for doing this. I believe it's just testing if any of the bits 17 - 31 have been set to one?
> >>>>>>>>
> >>>>>>>> I'd be grateful if someone would explain why this is being done. I imagine I've missed something there or the IIgs Reference Manuals.
> >>>>>>> Oh, it's checking to see if wmTaskData4 is less than 32768
> >>>>>> Yes, that's correct. In this case wmTaskData4 holds a control ID value, and all the control IDs that the code wants to check for are less than 32768. The "if" check is OK, but it's not really necessary, since the code could just check for the control IDs of interest via the "switch".
> >>>>>>
> >>>>>> I suspect the "if" check is there because the code was originally written in Pascal for the Toolbox Programming in Pascal course and then later translated to C. The "case" statement in ORCA/Pascal can only handle values up to 32767, making a check like this necessary, but the "switch" statement in C does not have the same limitation.
> >>>>>>
> >>>>>> --
> >>>>>> Stephen Heumann
> >>>>> Ahh, thank you very much.
> >>>>
> >>>> May I ask though; why go about it this way: if ((myEvent.wmTaskData4 & 0xFFFF8000) == 0) rather than: if(myEvent.wmTaskData4 <= 32767) ?
> >>>>
> >>>> is there a reason? or just a choice?
> >>>>
> >>> It is easier to read. :)
> >>>
> >>> No, really. 32767 is meaningless in that context. wmTaskData4 contains a
> >>> bunch of seperate settings coded as bits, not a single number.
> >>>
> >>> 0xFFFF8000 is 1111 1111 1111 1111 1000 0000 0000 0000 in binary form,
> >>> and by ANDing wmTaskData4 with this number, you say "I am only
> >>> interested in the upper 17 bits, ignore the lower bits."
> >>> The IF condition then means "If none of the settings in the upper 17
> >>> bits is set, do the following."
> >>>
> >>> Dirk
> >> I get the ANDing to test if bits are set and that's what I thought first too but as far as I've read the only thing wmTaskData4 ever contains is a zero or a control id; it, wmTaskData4, isn't flags bits. Only after playing ANDing that I stumbled upon 00000000000000001111111111111111, 0x7FFF, 32768 triggers that condition <shrug>
> >>
> >> Was just wondering why.
> >
> > He has a sense of humor. I think he was just messing with me.
> I have to admit that I didn't really check what kind of values
> wmTaskData4 can contain. You and Stephen are correct, it should contain
> the ID of a control in your dialog.
>
> But maybe it contains other things in certain conditions. Otherwise that
> check would not be needed (if you only have controls with small ID
> numbers). If the event handling is done for a modeless dialog, for
> example, it would be useful to ignore all unknown events.
>
> I just tried to explain the hex form in the statement. You don't need to
> play with values to find out the meaning if you write a constant that
> way. It is like a mask for specific bits.
>
> No, I don't have a sense of humor.
>
> ;)
>
> Dirk

Re: sense of humor. I was referring to Mike Westerfield and I was just kidding.

I appreciate the comments and I understand using AND and OR to test/mask bits fairly well. I just didn't quite understand it's use pertaining to wmTaskData4 and thought I must have missed something in the reference manuals, all too likely, as to why/when any of those bits would be set.

if as Stephen suggested it's a Pascal case statement limit of 32767 for all I know that is the most efficient way to test for that. I'm sure Mike Westerfield had a reason for doing it that way other than to see if anyone would ask why.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor