dc showmanship (was: Need background on design of groff character classes)

"G. Branden Robinson" <[email protected]>
Newsgroups gmane.comp.printing.groff.general
Message-ID <20260110225728.63ijsrklixsst24d@illithid>
I left out a footnote mark.  And since I'm here (and still waiting on
the GNU admins to issue my automated upload credentials[A]), I'll
indulge the Unix nerdery I forwent previously.

At 2026-01-10T15:43:05-0600, G. Branden Robinson wrote:
[...]
> The rationale for the `class` request was to facilitate groff usage by
> those composing documents in Chinese or Japanese.  To do so well means
> applying character flags to the characters used by thse languages'
> scripts.  Such characters are numerous.  Here's a sample.
> 
> tmac/zh.tmac:
>     .\" Chinese glyphs.
>     .class [CJKnormal] \
>       \[u4E00]-\[u9FFF]
> 
>     .cflags 512 \C'[CJKnormal]'
> 
> That's--let's see...
> 
> $ echo 'ibase=16;(FFF+1)*(9-5)+2*(FF+1)' | bc
> 16896
> 
> (Derivation available on request.)[7]
> 
> ...almost 17,000 characters affected for Chinese.
[...]
> [7] I admit, I was tempted to perform this calculation in dc(1)
>     instead.  But (a) I'm not au fait enough with it to casually toss
>     off an RPN version of that algebra--I'd need to check the man page
>     to see how to change the input base, which may be the 'i' command
>     but maybe not--and (b) this discussion is probably already
>     esoteric enough without such a gratuitous display.

Gratuitous display, complete with Thompsonesque gratuitous neglect of
spacing between operators:

$ echo '16i1 FFF+9 5-*FF 1+2*+p' | dc
16896

Took only a few tries.  The 'f' command stands for 'friendly'.

Regards,
Branden
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAmli2VEACgkQ0Z6cfXEm
bc5tNw//fGeUDB3xvB/TT8RbpeG3oBsRYOkge74MsStvzgPiRpgKAdNEmEd2R/Kj
dAtGfdJLiR0+gS19WWgpo45bWJ9uveLwZ6ZRxGdOP9NY7GbcDQleLtXTafZgh/84
jBkZmOHK8zDs3bnzi883XYse6KcSW1DFzquFWqs22uEyXV0BnmKgKhUm5kGdAEVH
SlFsGObAPsc/6tqXhGR0aYVH/XG7j5YMQCb5OT+B34ssX36WyXaLc2YIYO3CGwZz
ybQLuwL9PMj/rSd1X92x3TM7lnuOdhfY+VwTUZ06BSLV9ri1Wi8s06Yz8KBnvsUk
DferIZlqCri466UFGmNAJOx12U24FNKBtUDJCdtAMlT5ruw/qTWP0+OEoZrjl5+B
2DpdsCdbWcpJ4rgGmCGFs2DRX+rAG8GU9fQ3+hPRVwlGv9JRdRa3zHaI36vU9ovZ
bg3mdfc4HG1j83JkpAyxzkI9gzNvnyIsglrEWoczh3hGzVP60dS+TuDa906PItv5
kAVcfQmsN1uvcRg9Rd/X2lq2aaWobTMkOuLNV3a38wSin+MralF+6Mf4GOR45hHH
xfEbnEAr47CiyZsIWxBUDPYBZQgYgFKk3oJr2gSA059CxpavSudBRZzTOI9I55FX
5XT+nFlna/iA78xZpKnVBEOCmDFcs0tU2mgr95woFQyUSCFZHk0=
=Nz80
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.