Re: Style(9): Allow // comments

From: Stefan Esser <se_at_FreeBSD.org>
Date: Mon, 08 Aug 2022 08:48:25 UTC
Am 08.08.22 um 02:01 schrieb Julian H. Stacey:
> Hi Stefan & arch@
> (Apologies for delay, traveling)
> 
> Stefan Esser wrote: Sun, 31 Jul 2022 07:42:44 +0200
[...]
>> And I did not see any issues with the use of // in URLs in calendar files
>> in my testing.
> 
> I had problems before with numerous of my own calendar files
> 	(on hosts from 9.2-rel to current), & some were // related, (
> 	Maybe I'd re-introduced // usage in my calendars, hoping
> 	to migrate my old hosts to newer releases, then got stuck
> 	on old releases.
> 	Now I'm travelling with laptop, other (non calendar) problems
> 	forced me back from current to stable, & stable to 12.3-release,
> 	with a 9.3 fallback bootble, & no up to date current.  When
> 	I return I'll have a 9.2 as well again, & a current sometime
> 	later again. )

Only very rudimentary pre-processing of calendar entries was implemented
in the calendar program between September 2013 and October 2020, due to
the removal of piping through the traditional C pre-processor.

The improved parsing of C pre-processor commands has been merged to
FreeBSD-12, but not to FreeBSD-11 and before.

On older releases I'd suggest to use the deskutils/calendar port to
provide a version that parses calendar files identical to the version
in -CURRENT.

> Before my earlier post, I checked man calendar (on 12.3-rel, & as //
> wasn't listed, just /* */, & as I want my calendars to run on 9.2
> (& way older back to 4.11 & 6.4) through current, I purged all my //
> comments leaving just // as text in http://www etc.

I'm not sure that the calendar port can be built on very old FreeBSD
releases. IIRC, I have tested it on FreeBSD-11, some time ago, but not
on any prior version.

The calendar port depends on the calendar-data port, which provides
updated entries for EoL FreeBSD releases, too. But it depends on
ICONV features, since the entries have been converted to UTF-8 for
easier maintenance.

[...]
> Apologies, I've been distracted by constant time wasters starting
> with Brexit.  I trawled my mail archive, & found one mail to you re.
> calendar of Sun, 25 Oct 2020 01:35:07 +0200, if there's others you'r
> waiting on, please resend to me.

Yes, that's part of the mail thread I was thinking of ...

I took no reply as "it's working well enough for me" ;-)

>> The calendar program treats // as the start of a comment only at the beginning
>> of a line or if it follows white space. This detail was missing in the calendar
>> man page and I have just added it on -CURRENT.
> 
> Useful, Noted to my ~/.calendar/calendar so I see it on older releases.

I have just updated the deskutils/calendar port to match -CURRENT.
The only change was the better description of // in the man page.

>> Please let me know if calendar files are not parsed as expected and as
>> documented.
> 
> Thanks, will do.

Please send examples of entries that do not parse as expected.

I have not worked on the parsing of calendar entries for a while,
but if something is missing or not working as expected, I'll put
it on my ToDo list.

One feature that has been requested (but is not trivial to implement,
given the structure of the code) is correct processing of UK bank
holidays that fall on a weekend. (The same logic would be applicable
to e.g. Japanese bank holidays, too.)

Regards, STefan