Skip to content

Commit e0a5523

Browse files
committed
Split oversized MUX modules
1 parent 3d102dc commit e0a5523

105 files changed

Lines changed: 15695 additions & 14022 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,15 @@ if(BUILD_TESTING)
310310
"${CMAKE_SOURCE_DIR}/src")
311311
add_test(NAME event_timer COMMAND event_timer_test)
312312

313+
add_executable(red_black_tree_test tests/red_black_tree.c
314+
${MUX_SOURCE_DIR}/support/red_black_tree.c
315+
${MUX_SOURCE_DIR}/support/red_black_tree_mutation.c)
316+
target_link_libraries(red_black_tree_test PRIVATE btmux_options)
317+
target_include_directories(red_black_tree_test PRIVATE
318+
"${CMAKE_BINARY_DIR}"
319+
"${CMAKE_SOURCE_DIR}/src")
320+
add_test(NAME red_black_tree COMMAND red_black_tree_test)
321+
313322
add_executable(libuv_tcp_integration_test tests/libuv_tcp_integration.c)
314323
target_link_libraries(libuv_tcp_integration_test
315324
PRIVATE btmux_options SQLite3::SQLite3)

docs/content/en/docs/concepts/source-layout.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ descriptive PascalCase names. Functions use snake_case, and implementation
2626
details remain private to their owning module unless another translation unit
2727
needs them.
2828

29+
Large subsystems use several translation units instead of collecting unrelated
30+
operations in one source file. Command registration, dispatch, configuration,
31+
listing, builder operations, state inspection, and examination are separate;
32+
channels separate delivery, aliases, management, presence, and administration;
33+
networking separates timing, output, connection lifecycle, commands, and site
34+
access; and SQLite and Lua code separate their schemas or runtimes from loading,
35+
storage, callbacks, scheduling, flows, and bindings. Headers ending in
36+
`_internal.h` are private contracts between translation units in one subsystem
37+
and must not be included by other subsystems.
38+
2939
Object flags and powers are represented by individual boolean fields in memory
3040
and matching SQLite columns. Flags use `has_*_flag` names and powers use
3141
`has_*_power` names; command names omit those storage-oriented affixes (for

justfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ stylua := env_var_or_default("STYLUA", "stylua")
99

1010
default: fmt build test install
1111

12-
ci: fmt-check build test
12+
ci: check-mux-source-size fmt-check build test
1313

1414
agent-checks: ci
1515

16+
check-mux-source-size:
17+
status=0; while IFS= read -r -d '' source; do lines=$(awk 'END { print NR }' "$source"); if (( lines > 800 )); then echo "$source: $lines lines (maximum 800)"; status=1; fi; done < <(find src/mux -type f \( -name '*.c' -o -name '*.h' -o -name '*.h.in' \) -print0); exit "$status"
18+
1619
fmt:
1720
find src -type f \( -name '*.c' -o -name '*.h' -o -name '*.h.in' \) -print0 | xargs -0 -r {{clang_format}} -i
1821
{{stylua}} --glob '**/*.lua' -- game/lua
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Private helpers shared by builder command implementations. */
2+
3+
#pragma once
4+
5+
#include "mux/objects/db.h"
6+
7+
typedef struct EvaluationContext EvaluationContext;
8+
9+
char *builder_compile_object_name(EvaluationContext *evaluation, DbRef player,
10+
const char *name);

0 commit comments

Comments
 (0)