Files
Konrad d2e06b316d splinter: curses TUI on NetBSD curses, CDE palettes as themes
The harness now has the interface it was missing: a chat pane on three
quarters of the screen, a sidebar on one quarter, a status bar underneath.

- vendor/netbsd-curses: NetBSD's curses and terminfo, ported edition,
  vendored with PROVENANCE.md. The build of that one directory needs GNU
  make; splinter's own Makefile stays POSIX make.
- tools/genpalettes.py turns CDE's *.dp palette files into a C table. 42
  palettes, generated, checked in with the generator, so the source of every
  colour is a file in the CDE tree and not a guess.
- themes: roles are derived, not invented - background is the darkest of the
  eight colour sets, foreground the lightest, border the second darkest,
  accent the most saturated of the rest, status the accent darkened by a
  third. Delphinium is the default. Unknown palette is an error.
- colours map to the terminal through xterm's 256-colour cube when available,
  the 16 basic colours otherwise, so a palette looks the same everywhere
  within what the terminal can show.
- ui.c redraws only on change; the sidebar shows session, transport, theme
  and last-turn numbers. Widgets are a labelled empty area - the registry
  lands next.

Six test binaries green, including test_theme (42 palettes, ordering
invariants, unknown name rejected, colour indices in range).
2026-11-07 11:27:09 +00:00

49 lines
903 B
C

#ifndef EMALLOC_H
#define EMALLOC_H
/* replacement functions for emalloc() and friends used in netbsd code */
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
static void mallerr(void) {
dprintf(2, "error: out of memory\n");
abort();
}
static inline void* emalloc(size_t x) {
void *p=malloc(x);
if(!p) mallerr();
return p;
}
static inline void* ecalloc(size_t x, size_t y) {
void *p=calloc(x, y);
if(!p) mallerr();
return p;
}
static inline void* erealloc(void *x, size_t y) {
void *p=realloc(x, y);
if(!p) mallerr();
return p;
}
static inline char* estrdup(const char* x) {
char *p = strdup(x);
if(!p) mallerr();
return p;
}
static int easprintf(char **s, const char *fmt, ...) {
int ret;
va_list ap;
va_start(ap, fmt);
ret = vasprintf(s, fmt, ap);
va_end(ap);
if(ret == -1) mallerr();
return ret;
}
#endif