PS_OPEN_MEM(3)
π PS_open_mem β bestie, we're making PostScript in memory now π
okay so this is a page from the Library Functions Manual and it's literally about one lil function that spawns a whole PostScript document straight into memory. no files, no disk, just vibes and a callback. let's get into it π«Ά
β¨ NAME β¨
PS_open_mem β creates a PostScript document in memory π
πΈ SYNOPSIS πΈ
#include <pslib.h>
int PS_open_mem(PSDoc *psdoc, size_t (*writeproc)(PSDoc *p, void *data,
size_t size))
π DESCRIPTION π
So here's the tea: PS_open_mem creates a PostScript document in memory. π§
But the way it actually pulls that off? It uses your output function instead of the internal file output function. that's the whole trick. it's giving "you bring the pen, i'll bring the document" energy.
Which means it is up to the application calling this function what to do with the data passed to the writeproc. that's on you, bestie. the function does not have opinions. π
Important detail, no cap: the writeproc must return the number of written bytes. that's non-negotiable.
And heads up β writeproc is usually called at least once within any other function. so don't be surprised when it keeps showing up. it's the main character of this whole arrangement π
β RETURN VALUE β
- Returns
-1in case of an error π - Returns
0otherwise π
π¦ SEE ALSO π¦
go read those too, they're the sibling pages fr fr β¨
π AUTHOR π
This manual page was written by Uwe Steinmann uwe@steinmann.cx. iconic of them honestly π«Ά
aaaand that's the whole page, babe π this was PS_OPEN_MEM(3) from the Library Functions Manual β shoutout to the pslib girlies, mwah, go write some PostScript in memory, slay, periodt πβπ
π¦ where this page comes from
- debian bookworm: pslib-dev 0.4.7-1+b1
- debian trixie: pslib-dev 0.4.8-1+b1
- ubuntu jammy: pslib-dev 0.4.7-1
- ubuntu noble: pslib-dev 0.4.7-1build2
- ubuntu questing: pslib-dev 0.4.8-1
- ubuntu resolute: pslib-dev 0.4.8-1build1
- ubuntu stonking: pslib-dev 0.4.8-3 Β· GPL-2.0-or-later OR LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms