New Code!
Discount has been rolled up to version 3.0.1.2, and, whew, where do I begin?
- I ran out of slots in the original bitmap flags structure, so I dumped it and replaced it with a new flag blob accessed through a flag pointer. This broke the entire published interface and required the update to version 3 (this is why it took me over 3 years to implement it; I needed to test the code to within an inch of it’s life and between that and transitioning it just ate up time like you wouldn’t believe!)
- Because I changed the
mkd_flag_t
structure and replaced it with a blob, the old flags are now a pointer and using themkd_flag_isset()
,mkd_set_flag()
, andmkd_clr_flag()
functions I introduced during the end of the run for version 2.x.x is now mandatory unless you’re fond of core dumps. - The way I’d originally implemented HTML5 (if that’s even a thing anymore?) support was to have a global structure that I allocated once and then you were stuck with it forever (and had to deallocate the structure whenever you stopped using the library otherwise it would leak memory), so I fixed that for v3 by moving the html5 details inside the
MMIOT
(activated by setting the flagMKD_HTML5
) so it will automatically be deallocated when you are done with a document without affecting otherMMIOT
s. - Github user mwfont-csl suggested (and provided a patch – which, alas, I couldn’t use because github doesn’t seem to have a way to export patches by themselves?) adding support for fractional sizes on images as well as pixels sizes (so, 40%×40% instead of 40x40 pixesl), which I worked into the code using mwfong-csl’s original code as a reference.
- mwfong-csl also provided a patch to do extended attributes on links and image links, via putting those attributes into a
{...}
bracketed block immediately after the link. As before, I couldn’t figure out a way to export just a patch from github, so I worked it into the code using their original code as a reference. - Annoyingly, netbsd11, broke the implementation of
isspace()
by putting in a version that dumped core if the input character was outside the ranges of EOF or 0x00..0xff (I deliberately use the word broken because it broke the principle of least surprise, which either nobody cares about or is trying maliciously to stop people from using C anymore.) Fortunately could patch around this misbehavior by detecting it inconfigure.sh
and telling the compiler (clang and gcc; dunno about other compilers) to make the default character unsigned. - There are also a few of memory leaks remaining, and I fixed a couple of them before this release.
As usual, don’t be surprised if running this code makes your computer phase into another dimension, or, less excitingly, melt down; it’s been working for me™ but that’s no guarantee of success elsewhere. Do note that you need to recompile everything from scratch to use the new code, because I’ve kept the old interface around (but not actually accessable yet because I didn’t manage to set up compatibility flags correctly), internally named the new published interface with a v3 prefix, then hid it from the user by #define
ing all the v3mdk… functions to mkd…
And don’t forget to check all of your code that uses flags; since flags are now a blob, you need to allocate the flag structure (with mkd_flags()
) before attempting to use it, and you must never try to do bit manipulation on them because they are now a pointer to an black box!
But anyway, New Code™ ready for your downloading enjoyment – mirrored on github as well; download it today for an exciting tomorrow! :-)
EDIT: I forgot to null-terminate three strings, which my ci network didn’t catch :-( So instead of 3.0.1 it’s now 3.0.1.1 !
SECOND EDIT: My paranoid malloc code was returning buffers initialized to nulls, which hid even more strings I’d not null-terminated (as well as two structure allocations), so I had to fix that and make 3.0.1.1 into 3.0.1.2