CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
host_api_strings.cpp
Go to the documentation of this file.
1
9
12#include "host_str_conv.h"
13
14extern "C" int host_str_to_display(const char* in, char* out, size_t out_size, uint32_t target)
15{
16 if (!in || !out || out_size == 0) return HOST_ERR_INVALID_ARG;
17 auto t = (target == HOST_STR_TARGET_LATIN1)
20 cdc::ui::render::decodeWebText(in, out, out_size, t);
21 return HOST_OK;
22}
23
24extern "C" int host_str_to_utf8(const char* in, char* out, size_t out_size)
25{
26 return cdc::plugin_manager::copyUtf8(in, out, out_size);
27}
#define HOST_STR_TARGET_LATIN1
Definition host_api.h:1438
int host_str_to_utf8(const char *in, char *out, size_t out_size)
Convert CP437 display bytes in in to a UTF-8 string in out.
int host_str_to_display(const char *in, char *out, size_t out_size, uint32_t target)
Decode HTML entities + UTF-8 in in into single-byte display characters in out.
CDC Badge OS plugin host API - canonical C ABI contract.
#define HOST_OK
Definition host_api.h:37
#define HOST_ERR_INVALID_ARG
Definition host_api.h:39
Internal UTF-8 <-> CP437 helpers for the plugin host API boundary.
int copyUtf8(const char *cp437, char *out, size_t out_size)
Encode a CP437 string into a caller buffer as UTF-8.
void decodeWebText(const char *in, char *out, size_t out_size, DisplayTarget target=DisplayTarget::Cp437)
Normalises a web payload for display: HTML named/numeric entities decode first, then UTF-8 multibyte ...
@ Cp437
GFX builtin glcdfont (default after setFont(nullptr)).
@ Latin1
FreeMonoBold*pt8b fonts (Latin-1 indexed, 0x20..0xFF).