ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_export.h
Go to the documentation of this file.
1
14#pragma once
15
16#include <stddef.h>
17#include <stdint.h>
18
19#include "mdl_format.h"
20#include "mdl_storage.h"
21#include "ra8_err.h"
22
42
44const char* mdl_format_ext(mdl_format_t fmt);
45
73
85
87typedef enum : uint8_t {
91
111
126
146ra8_err_t mdl_meta_parse(mdl_export_meta_t* meta, const char* text);
147
168ra8_err_t mdl_meta_load_dir(mdl_storage_t* storage, mdl_export_meta_t* meta, const char* dir);
169
189ra8_err_t mdl_export_build_comicinfo(const mdl_export_meta_t* meta, char* buf, size_t cap);
190
212 size_t page_count,
213 char* buf,
214 size_t cap);
215
217typedef struct mdl_export_workspace {
218 uint8_t* data;
219 size_t cap;
220 size_t used;
221 size_t high_water;
223
239void mdl_export_workspace_init(mdl_export_workspace_t* ws, void* data, size_t cap);
240
258void* mdl_export_workspace_take(mdl_export_workspace_t* ws, size_t bytes, size_t alignment);
259
294 mdl_format_t fmt,
295 const char* chapter_dir,
296 const char* out_path,
297 const mdl_export_meta_t* meta,
299
325 mdl_format_t fmt,
326 const char* chapter_dir,
327 const char* out_path,
bool mdl_format_is_dir_output(mdl_format_t fmt)
Whether fmt writes per-page sibling files rather than one container.
Definition mdl_export.c:84
ra8_err_t mdl_export_build_comicinfo(const mdl_export_meta_t *meta, char *buf, size_t cap)
Generate ComicInfo.xml content from metadata.
void * mdl_export_workspace_take(mdl_export_workspace_t *ws, size_t bytes, size_t alignment)
Reserve aligned bytes from an exporter arena.
struct mdl_export_workspace mdl_export_workspace_t
Caller-owned bounded arena for all exporter scratch state.
ra8_err_t mdl_export_build_comicinfo_pages(const mdl_export_meta_t *meta, size_t page_count, char *buf, size_t cap)
Generate ComicInfo.xml including page count and direction semantics.
mdl_format_t mdl_format_from_str(const char *s)
Map a --format string to a container kind.
Definition mdl_export.c:32
mdl_meta_size_t
Sizing constants for metadata fields.
Definition mdl_export.h:75
@ k_mdl_meta_id_max
Stable publication identifier max bytes.
Definition mdl_export.h:82
@ k_mdl_meta_title_max
Title (series or chapter) buffer max bytes.
Definition mdl_export.h:76
@ k_mdl_meta_name_max
Person name (writer/artist) buffer max bytes.
Definition mdl_export.h:78
@ k_mdl_meta_date_max
ISO-8601 modified timestamp max bytes.
Definition mdl_export.h:83
@ k_mdl_meta_summary_max
Summary description buffer max bytes.
Definition mdl_export.h:77
@ k_mdl_meta_lang_max
BCP-47 language tag buffer max bytes.
Definition mdl_export.h:81
@ k_mdl_meta_path_max
Bounded host cover path, including NUL.
Definition mdl_export.h:80
@ k_mdl_meta_url_max
Absolute source URL max bytes, including NUL.
Definition mdl_export.h:79
const char * mdl_format_ext(mdl_format_t fmt)
File extension (without dot) for a format, e.g.
Definition mdl_export.c:58
ra8_err_t mdl_export_chapter_meta_ws(mdl_storage_t *storage, mdl_format_t fmt, const char *chapter_dir, const char *out_path, const mdl_export_meta_t *meta, mdl_export_workspace_t *ws)
Package a chapter with explicit metadata and caller-owned workspace.
Definition mdl_export.c:532
mdl_reading_direction_t
Logical page progression used by fixed-layout readers.
Definition mdl_export.h:87
@ k_mdl_read_rtl
Right-to-left page progression.
Definition mdl_export.h:89
@ k_mdl_read_ltr
Left-to-right page progression.
Definition mdl_export.h:88
ra8_err_t mdl_meta_parse(mdl_export_meta_t *meta, const char *text)
Parse metadata key-value lines or XML text into a metadata struct.
void mdl_export_workspace_init(mdl_export_workspace_t *ws, void *data, size_t cap)
Bind an exporter arena without allocating memory.
ra8_err_t mdl_meta_load_dir(mdl_storage_t *storage, mdl_export_meta_t *meta, const char *dir)
Load metadata from a directory by looking for metadata files.
ra8_err_t mdl_export_chapter_ws(mdl_storage_t *storage, mdl_format_t fmt, const char *chapter_dir, const char *out_path, mdl_export_workspace_t *ws)
Package a chapter after auto-loading bounded local metadata.
Definition mdl_export.c:592
void mdl_meta_init(mdl_export_meta_t *meta)
Initialise a metadata struct to empty/default values.
Shared media artifact format contract for download and export paths.
mdl_format_t
Artifact format selected by a media-download composition root.
Definition mdl_format.h:35
Injected portable storage resources for downloader domain code.
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
int cover_index
Cover page index (0-based, -1 if unset).
Definition mdl_export.h:105
char chapter_title[k_mdl_meta_title_max]
Chapter title.
Definition mdl_export.h:101
mdl_reading_direction_t reading_direction
Fixed-layout page progression.
Definition mdl_export.h:107
double chapter_number
Chapter number (0.0 if unnumbered).
Definition mdl_export.h:102
char identifier[k_mdl_meta_id_max]
Stable identifier; derived when empty.
Definition mdl_export.h:108
char language[k_mdl_meta_lang_max]
BCP-47 language tag (default "en").
Definition mdl_export.h:106
char cover_path[k_mdl_meta_path_max]
Trusted verified local cover path/name.
Definition mdl_export.h:104
char writer[k_mdl_meta_name_max]
Writer / Author.
Definition mdl_export.h:99
char artist[k_mdl_meta_name_max]
Artist / Illustrator.
Definition mdl_export.h:100
char modified[k_mdl_meta_date_max]
Deterministic ISO-8601 modified time.
Definition mdl_export.h:109
char source_url[k_mdl_meta_url_max]
Validated absolute HTTP(S) source URL.
Definition mdl_export.h:103
char summary[k_mdl_meta_summary_max]
Summary / description.
Definition mdl_export.h:98
char series_title[k_mdl_meta_title_max]
Series title.
Definition mdl_export.h:97
Caller-owned bounded arena for all exporter scratch state.
Definition mdl_export.h:217
size_t high_water
Largest used value observed.
Definition mdl_export.h:221
size_t used
Current allocation high edge.
Definition mdl_export.h:220
size_t cap
Total arena capacity.
Definition mdl_export.h:219
uint8_t * data
Writable arena bytes.
Definition mdl_export.h:218
One non-reentrant downloader filesystem dependency bundle.
Definition mdl_storage.h:40