Files
kenjreno 128ddcb4df v0.1.0: thread-safe pub/sub event bus
Verbatim port of Fastway-Server's TFWEventBus from fw_plugin_host.pas
per feedback_copy_dont_reinterpret.md.  Adjustments limited to:

  - Type renames (TFW* -> T*).
  - uses clause: drop fw_log; add log.types from fpc-log so the
    optional Logger property uses the canonical ecosystem-wide
    TLogProc shape, matching every other fpc-* library.
  - Per-handler exception logging now calls Logger with
    Level=llError, Category='events', and includes the source
    plugin (ASourcePlugin parameter) in the message text so the
    canonical signature stays meaningful.

Behaviours preserved verbatim: APluginName bulk-Unsubscribe key,
wildcard '*' subscriber, OnBroadcast external-listener tap,
snapshot-iterate-outside-lock pattern, per-handler exception
isolation, TCriticalSection.

docs/DEVELOPER_GUIDE.md added covering threading, payload
ownership, recursive Fire, OnBroadcast, logger plumbing, and
the relationship between fpc-events (ecosystem-wide pub/sub)
and per-library typed observer callbacks (bp.events / cm.events
pattern).

Tests: 44 assertions across 14 scenarios pass on x86_64-linux.
Pre-tag -vh audit on src/ev.bus.pas reports zero hints/warnings.
2026-05-05 18:13:10 -07:00

35 lines
684 B
Bash
Executable File

#!/bin/bash
# build.sh -- compile every unit in src/ in dependency order.
# Verifies the library is self-contained and free of FPC compile errors.
set -e
cd "$(dirname "$0")"
FPC=/opt/fpcup/fpc/bin/x86_64-linux/fpc
OUT=build
mkdir -p "$OUT"
UNITS=(
src/events.version.pas
src/events.bus.pas
)
for u in "${UNITS[@]}"; do
name=$(basename "$u" .pas)
printf " %-32s " "$name.pas"
if $FPC -O2 -Sh -B \
-Fusrc \
-Fu../fpc-log/src \
-FU"$OUT" \
-FE"$OUT" \
"$u" > "$OUT/$name.log" 2>&1; then
echo "OK"
else
echo "FAIL"
cat "$OUT/$name.log"
exit 1
fi
done
echo
echo "All targets built."