chiark / gitweb /
Remove ASCII dependency
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 17 Dec 2024 10:58:16 +0000 (10:58 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sun, 29 Dec 2024 18:50:11 +0000 (18:50 +0000)
commit602db761c25f8924122daba2bd4a11b420d5a9f9
treee6719da4cb7a5c025af429a000f23670d8308585
parent9b82a0f2640c808dbcbdf1383026a86a7fd0a7bf
Remove ASCII dependency

ISO C doesn't guarantee that the execution character set is ASCII, or
anything like it.  Bedstead tries to require only ISO C, but it used
strcmp() to sort glyph names and so the output depended on the sort
order of characters.  Moreover, the code for finding variants of
characters required that '.' have a lower value than any other
character that appeared in glyph names.

To avoid this dependency, we now have a table that assigns values to
each character that can appear in glyph names, and a strcmp-compatible
function that compares two strings after mapping through that table.
This means that our sort order is explicitly specified in the code,
and also provides a convenient place to catch unusual characters in
glyph names.

This change has no effect on the output TTX files (at least on an ASCII
system).  All remaining uses of strcmp() are testing solely for
equality.
bedstead.c