bartp5 / libtexprintf

Library providing printf-style formatted output routines with tex-like syntax support.
GNU General Public License v3.0
27 stars 2 forks source link

add texerrors_str #12

Closed stevengj closed 1 year ago

stevengj commented 1 year ago

This PR adds a new API function char *texerrors_str(), which is similar to texerrors() but returns a string (of ;-delimited error messages) rather than printing to stderr.

Rationale: returning a string makes it easier for the caller to decide what to do with the error message, and is especially important for calling from higher-level languages where the error message is typically wrapped in a thrown exception. (cc @Suavesito-Olimpiada)

It adds a test script testerrors.sh to check that it is working. I also updated the test scripts so that they use a $utftex environment variable (set by the Makefile) rather than running utftex from the $PATH. On my machine, make check gives:

PASS: runtest.sh
PASS: testfont.sh
PASS: testascii.sh
PASS: testerrors.sh

Plus a couple of other minor cleanups: I added a .gitignore file, and added a missing file errormessages.h to the list of BUILT_SOURCES.