ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_export_internal.h
Go to the documentation of this file.
1
15
16#pragma once
17
18#include <stddef.h>
19#include <stdint.h>
20
21#include "mdl_export.h"
23#include "miniz.h"
24#include "ra8_attributes.h"
25#include "ra8_err.h"
26
28typedef enum : uint16_t {
29 k_max_pages = 2048,
30 k_name_max = 256,
32
39
47
49typedef struct {
50 max_align_t alignment;
51 size_t span;
52 size_t bytes;
53 bool free;
55
63
81
97RA8_PRIV bool priv_mdl_export_snprintf_fit(int written, size_t cap);
98
113RA8_PRIV void priv_mdl_zip_workspace_bind(mz_zip_archive* zip,
114 mdl_zip_allocator_t* alloc,
116
130
146
169 const mdl_export_meta_t* meta,
170 const char names[][k_name_max],
171 size_t count,
172 mdl_external_cover_t* cover);
173
198 const char* dir,
199 char names[][k_name_max],
200 size_t count,
201 mdl_export_output_t* output,
202 const mdl_export_meta_t* meta,
204
227 const char* dir,
228 char names[][k_name_max],
229 size_t count,
230 mdl_export_output_t* output,
231 const mdl_export_meta_t* meta);
232
256 const char* dir,
257 char names[][k_name_max],
258 size_t count,
259 mdl_export_output_t* output,
260 const mdl_export_meta_t* meta,
262
287 const char* dir,
288 char names[][k_name_max],
289 size_t count,
290 mdl_export_output_t* output,
291 const mdl_export_meta_t* meta,
293
319 const char* directory,
320 char names[][k_name_max],
321 size_t count,
322 const char* destination,
323 const mdl_export_meta_t* meta,
324 mdl_export_workspace_t* workspace);
325
367 const char* dir,
368 const char names[][k_name_max],
369 size_t count,
Package a downloaded chapter folder into a reader-openable container.
struct mdl_export_workspace mdl_export_workspace_t
Caller-owned bounded arena for all exporter scratch state.
ra8_err_t priv_mdl_export_rabook(mdl_storage_t *storage, const char *directory, char names[][k_name_max], size_t count, const char *destination, const mdl_export_meta_t *meta, mdl_export_workspace_t *workspace)
Compile one page directory into a strict chunked RABOOK artifact.
ra8_err_t priv_mdl_export_cbz(mdl_storage_t *storage, const char *dir, char names[][k_name_max], size_t count, mdl_export_output_t *output, const mdl_export_meta_t *meta, mdl_export_workspace_t *ws)
Write a CBZ into a caller-owned staged output.
ra8_err_t priv_mdl_export_tar_gzip(mdl_storage_t *storage, const char *dir, char names[][k_name_max], size_t count, mdl_export_output_t *output, const mdl_export_meta_t *meta, mdl_export_workspace_t *ws)
Write a gzip-wrapped CBT archive.
ra8_err_t priv_mdl_zip_workspace_error(const mdl_zip_allocator_t *alloc)
Classify a miniz writer failure.
ra8_err_t priv_mdl_export_jof(mdl_storage_t *storage, const char *dir, const char names[][k_name_max], size_t count, mdl_export_workspace_t *ws)
Convert every page in a chapter directory to a sibling .jof atlas.
ra8_err_t priv_mdl_export_validate_source_url(const char *url)
Validate an optional bounded source-attribution URL.
mdl_cover_bounds_t
Fixed storage used to describe a validated external cover.
@ k_cover_mime_bytes
Canonical image MIME buffer.
@ k_cover_entry_bytes
Canonical archive member path.
@ k_cover_ext_bytes
Canonical image extension buffer.
void priv_mdl_zip_workspace_bind(mz_zip_archive *zip, mdl_zip_allocator_t *alloc, mdl_export_workspace_t *ws)
Bind a miniz archive to caller-owned bounded storage.
mdl_export_limits_t
Fixed bounds on the per-chapter page list.
@ k_max_pages
Maximum page entries per chapter.
@ k_name_max
Maximum entry-name bytes.
ra8_err_t priv_mdl_export_epub(mdl_storage_t *storage, const char *dir, char names[][k_name_max], size_t count, mdl_export_output_t *output, const mdl_export_meta_t *meta, mdl_export_workspace_t *ws)
Write a fixed-layout EPUB3 archive.
void priv_mdl_zip_workspace_release(mdl_zip_allocator_t *alloc)
Restore a workspace after a miniz writer ends.
ra8_err_t priv_mdl_export_tar(mdl_storage_t *storage, const char *dir, char names[][k_name_max], size_t count, mdl_export_output_t *output, const mdl_export_meta_t *meta)
Write an uncompressed CBT tar archive.
bool priv_mdl_export_snprintf_fit(int written, size_t cap)
Report whether an snprintf result fit its destination.
ra8_err_t priv_mdl_export_prepare_cover(mdl_storage_t *storage, const mdl_export_meta_t *meta, const char names[][k_name_max], size_t count, mdl_external_cover_t *cover)
Validate and canonicalize an external cover.
Private portable byte-stream contracts for media exporters.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Rich series and chapter metadata for export containers (ComicInfo.xml, EPUB OPF).
Definition mdl_export.h:96
One validated staged publication, including random ZIP backfill.
Validated external cover details retained without owning storage.
const char * source
Trusted caller-owned source path.
char entry[k_cover_entry_bytes]
Canonical relative member path.
char mime[k_cover_mime_bytes]
MIME derived from magic bytes.
bool external
True when a separate cover exists.
One non-reentrant downloader filesystem dependency bundle.
Definition mdl_storage.h:40
Per-writer adapter from miniz callbacks to one caller workspace.
size_t floor
Cursor restored after writer end.
mdl_export_workspace_t * ws
Exclusive caller-owned workspace.
mdl_zip_block_t * first
First miniz block, or NULL.
bool exhausted
A callback exceeded bounded space.
Metadata stored immediately before each bounded miniz allocation.
size_t bytes
Requested payload bytes currently preserved.
bool free
Whether this block can satisfy a later request.
max_align_t alignment
Forces following payload to maximum alignment.
size_t span
Aligned header-plus-payload bytes in this block.