comparison 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
comparison
equal deleted inserted replaced
243:823f2a8b16c8 244:b8aa08503378
1 #ifndef MRJUNEJUNE_LATEX_RENDERER_H
2 #define MRJUNEJUNE_LATEX_RENDERER_H
3
4 #include <stddef.h>
5 #include <stdint.h>
6
7 #define LATEX_SOURCE_MAX_BYTES (64 * 1024)
8 #define LATEX_PDF_MAX_BYTES (4 * 1024 * 1024)
9
10 typedef enum {
11 LATEX_RENDER_OK = 0,
12 LATEX_RENDER_INVALID_INPUT,
13 LATEX_RENDER_COMPILE_ERROR,
14 LATEX_RENDER_TIMEOUT,
15 LATEX_RENDER_COMPILER_UNAVAILABLE,
16 LATEX_RENDER_SANDBOX_ERROR,
17 LATEX_RENDER_INTERNAL_ERROR,
18 } Latex_Render_Status;
19
20 typedef struct {
21 Latex_Render_Status status;
22 uint8_t *pdf_data;
23 size_t pdf_size;
24 char *diagnostics;
25 } Latex_Render_Result;
26
27 Latex_Render_Result Latex_Render(const uint8_t *source, size_t source_size);
28 void Latex_Render_Result_Destroy(Latex_Render_Result *result);
29
30 #endif