This adds a new API function char *texstring(const char *str), which is similar to stexprintf but doesn't do any printf formatting. (stexprintf is refactored to call texstring, so there isn't much duplication.)
It is useful to expose this lower-level functionality, e.g. for calling from higher-level languages that have their own printf-like functionality (e.g. Python f-strings) that may or may not use the same syntax. It's not equivalent to simply calling stexprintf with no arguments, because then you have to worry about escaping % characters. cc @Suavesito-Olimpiada
Also added a test script testsprintf.sh to test stexprintf — that function wasn't previously being tested; this involved adding an -S option to utftex so that it calls puts(stexprintf(...)) instead of texprintf(...).
This adds a new API function
char *texstring(const char *str)
, which is similar tostexprintf
but doesn't do anyprintf
formatting. (stexprintf
is refactored to calltexstring
, so there isn't much duplication.)It is useful to expose this lower-level functionality, e.g. for calling from higher-level languages that have their own
printf
-like functionality (e.g. Python f-strings) that may or may not use the same syntax. It's not equivalent to simply callingstexprintf
with no arguments, because then you have to worry about escaping%
characters. cc @Suavesito-OlimpiadaAlso added a test script
testsprintf.sh
to teststexprintf
— that function wasn't previously being tested; this involved adding an-S
option toutftex
so that it callsputs(stexprintf(...))
instead oftexprintf(...)
.(Will need a rebase/merge once #12 is merged.)