import only the modules each unit uses

An import brings the types and constants its interface needs now
(sex#58): a module pub-imports what its pub forms hold, and sexc
refuses one that does not. Every unit had imported its whole
dependency chain in order to make up for it.

worldgen also pub-imports json, whose cJSON.h its pub fns take
pointers into; a type only C knows is not something sexc can check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 18:22:41 +03:00
parent b8030b86bc
commit 1b6ac779a8
12 changed files with 2 additions and 78 deletions

View File

@@ -9,16 +9,8 @@
(pub include pthread.h) (pub include pthread.h)
(include stdio.h stdlib.h string.h math.h) (include stdio.h stdlib.h string.h math.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import maps) (import maps)
(import lcg)
(import noise)
(import shape)
(import json)
(pub import worldgen) (pub import worldgen)
(import fastnoise)
(pub import rivers) (pub import rivers)
(import terra) (import terra)
(import strata) (import strata)

View File

@@ -20,9 +20,6 @@
;;; can't be read at all without the deposits. ;;; can't be read at all without the deposits.
(include stdio.h stdlib.h string.h math.h dirent.h) (include stdio.h stdlib.h string.h math.h dirent.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import cs) (import cs)
(import maps) (import maps)
(pub import lcg) (pub import lcg)
@@ -30,8 +27,6 @@
(import shape) (import shape)
(import json) (import json)
(pub import worldgen) (pub import worldgen)
(import fastnoise)
(import rivers)
(import terra) (import terra)
(import strata) (import strata)

View File

@@ -10,12 +10,7 @@
;;; every RNG call is the mod's: it is what the layout depends on. ;;; every RNG call is the mod's: it is what the layout depends on.
(include stdlib.h string.h math.h) (include stdlib.h string.h math.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import maps)
(pub import lcg) (pub import lcg)
(import noise)
(import shape) (import shape)
(import json) (import json)
(import worldgen) (import worldgen)

View File

@@ -11,16 +11,8 @@
(pub include pthread.h) (pub include pthread.h)
(include stdio.h stdlib.h string.h math.h) (include stdio.h stdlib.h string.h math.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import maps) (import maps)
(import lcg)
(import noise)
(import shape)
(import json)
(pub import worldgen) (pub import worldgen)
(import fastnoise)
(pub import rivers) (pub import rivers)
(import terra) (import terra)
(import strata) (import strata)

View File

@@ -3,15 +3,8 @@
;;; has the seed as typed and the world config as strings. ;;; has the seed as typed and the world config as strings.
(include stdio.h stdlib.h string.h) (include stdio.h stdlib.h string.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import cs) (import cs)
(import json) (import json)
(import maps)
(import lcg)
(import noise)
(import shape)
(import save) (import save)
(pub import worldgen) (pub import worldgen)

View File

@@ -10,17 +10,10 @@
;;; if it were rock, as the game's prospecting assumes too. ;;; if it were rock, as the game's prospecting assumes too.
(include stdio.h stdlib.h string.h math.h) (include stdio.h stdlib.h string.h math.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(pub import maps) (pub import maps)
(import lcg)
(import noise) (import noise)
(import shape)
(import json) (import json)
(import worldgen) (import worldgen)
(import fastnoise)
(import rivers)
(pub import terra) (pub import terra)
(pub define MAX-ROCKS 32) (pub define MAX-ROCKS 32)

View File

@@ -10,14 +10,9 @@
;;; certainly air above. ;;; certainly air above.
(include stdio.h stdlib.h string.h math.h) (include stdio.h stdlib.h string.h math.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(pub import maps) (pub import maps)
(import lcg)
(import noise) (import noise)
(import shape) (import shape)
(import json)
(pub import worldgen) (pub import worldgen)
(pub import fastnoise) (pub import fastnoise)
(pub import rivers) (pub import rivers)

View File

@@ -13,13 +13,7 @@
(pub include pthread.h SDL3/SDL.h) (pub include pthread.h SDL3/SDL.h)
(include stdio.h stdlib.h string.h math.h) (include stdio.h stdlib.h string.h math.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import json)
(import maps) (import maps)
(import lcg)
(import noise)
(pub import shape) (pub import shape)
(pub import worldgen) (pub import worldgen)
(import fastnoise) (import fastnoise)

View File

@@ -3,17 +3,10 @@
;;; map matches to the pixel, padding included. ;;; map matches to the pixel, padding included.
(include stdio.h stdlib.h string.h math.h time.h) (include stdio.h stdlib.h string.h math.h time.h)
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import maps) (import maps)
(import lcg)
(import noise)
(import json)
(import shape) (import shape)
(import save) (import save)
(import worldgen) (import worldgen)
(import fastnoise)
(pub import rivers) (pub import rivers)
(import terra) (import terra)
(import strata) (import strata)

View File

@@ -12,17 +12,10 @@
;;; quits, which is how the viewer is checked without looking at it. ;;; quits, which is how the viewer is checked without looking at it.
(include stdio.h stdlib.h string.h math.h unistd.h "nk.h" "stb_image_write.h") (include stdio.h stdlib.h string.h math.h unistd.h "nk.h" "stb_image_write.h")
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import cs) (import cs)
(import json)
(import maps) (import maps)
(import lcg)
(import noise) (import noise)
(import shape)
(import worldgen) (import worldgen)
(import fastnoise)
(import rivers) (import rivers)
(import terra) (import terra)
(import strata) (import strata)

View File

@@ -2,23 +2,12 @@
;;; against a saved world and dumps what either side produced. ;;; against a saved world and dumps what either side produced.
(include stdio.h string.h) (include stdio.h string.h)
;; An import brings in a module's own public forms but not the types
;; they mention, so dependencies come first.
;; TODO sex#58: import only the modules used here once an import brings
;; the types its interface needs; until then, every dependency, in
;; dependency order.
(import cs) (import cs)
(import json) (import json)
(import maps)
(import lcg)
(import noise)
(import shape)
(import save) (import save)
(import dump) (import dump)
(import worldgen) (import worldgen)
(import fastnoise)
(import rivers) (import rivers)
(import terra)
(import strata) (import strata)
(import settings) (import settings)
(import ores) (import ores)

View File

@@ -4,10 +4,10 @@
;;; the worldgen assets and the region's coordinates. ;;; the worldgen assets and the region's coordinates.
(include stdio.h stdlib.h string.h math.h) (include stdio.h stdlib.h string.h math.h)
(import maps) (pub import maps)
(pub import lcg) (pub import lcg)
(import noise) (import noise)
(import json) (pub import json)
(pub import shape) (pub import shape)
(pub define MAX-PROVINCES 32) (pub define MAX-PROVINCES 32)