Mercurial
diff mrjunejune/latex_renderer.h @ 244:b8aa08503378
[tools] Add sandboxed online LaTeX editor
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 03 Aug 2026 16:56:25 -0700 |
| parents | |
| children | b8b6e726964a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mrjunejune/latex_renderer.h Mon Aug 03 16:56:25 2026 -0700 @@ -0,0 +1,30 @@ +#ifndef MRJUNEJUNE_LATEX_RENDERER_H +#define MRJUNEJUNE_LATEX_RENDERER_H + +#include <stddef.h> +#include <stdint.h> + +#define LATEX_SOURCE_MAX_BYTES (64 * 1024) +#define LATEX_PDF_MAX_BYTES (4 * 1024 * 1024) + +typedef enum { + LATEX_RENDER_OK = 0, + LATEX_RENDER_INVALID_INPUT, + LATEX_RENDER_COMPILE_ERROR, + LATEX_RENDER_TIMEOUT, + LATEX_RENDER_COMPILER_UNAVAILABLE, + LATEX_RENDER_SANDBOX_ERROR, + LATEX_RENDER_INTERNAL_ERROR, +} Latex_Render_Status; + +typedef struct { + Latex_Render_Status status; + uint8_t *pdf_data; + size_t pdf_size; + char *diagnostics; +} Latex_Render_Result; + +Latex_Render_Result Latex_Render(const uint8_t *source, size_t source_size); +void Latex_Render_Result_Destroy(Latex_Render_Result *result); + +#endif