feat: ports - libnsutils, libnslog, libutf8proc, libnspsl, libnsgif, libnsbmp

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018Ae69wJS7sueQMUwNxV3nX
This commit is contained in:
2026-08-07 20:28:37 +02:00
co-authored by Claude Opus 5
parent f1d17b62c1
commit d14c8565d3
16 changed files with 251 additions and 0 deletions
+6
View File
@@ -25,6 +25,12 @@ SYSROOT_LIBS := \
$(PORT_SYSROOT_LIB)/libhubbub.a \
$(PORT_SYSROOT_LIB)/libparserutils.a \
$(PORT_SYSROOT_LIB)/libwapcaplet.a \
$(PORT_SYSROOT_LIB)/libnsutils.a \
$(PORT_SYSROOT_LIB)/libnslog.a \
$(PORT_SYSROOT_LIB)/libnspsl.a \
$(PORT_SYSROOT_LIB)/libnsgif.a \
$(PORT_SYSROOT_LIB)/libnsbmp.a \
$(PORT_SYSROOT_LIB)/libutf8proc.a \
$(PORT_SYSROOT_LIB)/libz.a
TEST_ELF := $(OUTDIR)/test/porttest.elf
+36
View File
@@ -6,6 +6,10 @@
#include <hubbub/parser.h>
#include <libcss/libcss.h>
#include <dom/dom.h>
#include <nsutils/time.h>
#include <nsgif.h>
#include <libnsbmp.h>
#include <libutf8proc/utf8proc.h>
#include <zlib.h>
#include <stdio.h>
#include <string.h>
@@ -19,6 +23,17 @@ static css_error pt_resolve_url(void *pw, const char *base,
return CSS_OK;
}
/* libnsgif needs a bitmap callback table; nothing is decoded here, so these
are only enough to satisfy nsgif_create(). */
static void *pt_bitmap_create(int w, int h) { (void) w; (void) h; return NULL; }
static void pt_bitmap_destroy(void *bm) { (void) bm; }
static uint8_t *pt_bitmap_get_buffer(void *bm) { (void) bm; return NULL; }
static const nsgif_bitmap_cb_vt pt_gif_bitmap_cbs = {
.create = pt_bitmap_create,
.destroy = pt_bitmap_destroy,
.get_buffer = pt_bitmap_get_buffer,
};
int main(void) {
lwc_string *a = NULL, *b = NULL;
bool same = false;
@@ -110,6 +125,27 @@ int main(void) {
if (doc != NULL) dom_node_unref(doc);
}
/* Support libraries: construct/query rather than just resolve symbols. */
{
uint64_t ms = 0;
nsgif_t *gif = NULL;
const utf8proc_property_t *prop;
printf("libnsutils: monotonic time %s\n",
(nsu_getmonotonic_ms(&ms) == NSUERROR_OK) ? "PASS" : "FAIL");
printf("libnsgif: create %s\n",
(nsgif_create(&pt_gif_bitmap_cbs, NSGIF_BITMAP_FMT_R8G8B8A8,
&gif) == NSGIF_OK && gif != NULL) ? "PASS" : "FAIL");
if (gif != NULL) nsgif_destroy(gif);
/* U+00E9 LATIN SMALL LETTER E WITH ACUTE -> category Ll */
prop = utf8proc_get_property(0x00E9);
printf("libutf8proc: property lookup %s\n",
(prop != NULL && prop->category == UTF8PROC_CATEGORY_LL)
? "PASS" : "FAIL");
}
lwc_string_unref(a); lwc_string_unref(b);
parserutils_buffer_destroy(buf);
return 0;