size the thread and file arrays by their constants

An array of a header type takes a symbolic size now (sex#60). The
records holding them are pub, so their constants are too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 18:07:07 +03:00
parent d299ba05ac
commit 9bc1167782
3 changed files with 5 additions and 11 deletions

View File

@@ -323,9 +323,7 @@
(var n int 0) (var n int 0)
(list-files root "" paths (& n)) (list-files root "" paths (& n))
(qsort paths n (sizeof [paths 0]) by-name) (qsort paths n (sizeof [paths 0]) by-name)
;; TODO sex#60: size with MAX-DEPOSIT-FILES once arrays of a header (var files [* cJSON MAX-DEPOSIT-FILES])
;; type take a symbolic size.
(var files [* cJSON 64])
(for (var f int 0) (< f n) (++ f) (for (var f int 0) (< f n) (++ f)
(var path [char 1024]) (var path [char 1024])
(snprintf path (sizeof path) "%s/%s" root [paths f]) (snprintf path (sizeof path) "%s/%s" root [paths f])

View File

@@ -31,12 +31,10 @@
;;; mask the least reading category. ;;; mask the least reading category.
(pub define SEARCH-MINERAL 4) (pub define SEARCH-MINERAL 4)
(define SEARCH-STEP 16) (define SEARCH-STEP 16)
(define MAX-SEARCH-THREADS 16) (pub define MAX-SEARCH-THREADS 16)
;; TODO sex#60: size threads with MAX-SEARCH-THREADS once arrays of a
;; header type take a symbolic size.
(pub record search (pub record search
((lock pthread-mutex-t) (threads [pthread-t 16]) (thread-count int) (running bool) ((lock pthread-mutex-t) (threads [pthread-t MAX-SEARCH-THREADS]) (thread-count int) (running bool)
(cancel bool) (cancel bool)
;; the question ;; the question
(settings world-settings) (rivers river-config) (assets-dir [char 1024]) (settings world-settings) (rivers river-config) (assets-dir [char 1024])

View File

@@ -50,7 +50,7 @@
;;; River tiles are sampled at a resolution the viewer picks by zoom, ;;; River tiles are sampled at a resolution the viewer picks by zoom,
;;; in the key's `stratum': a column costs too much to sample them all ;;; in the key's `stratum': a column costs too much to sample them all
;;; for an overview. ;;; for an overview.
(define MAX-WORKERS 32) (pub define MAX-WORKERS 32)
(define TILE-FREE 0) (define TILE-FREE 0)
(define TILE-QUEUED 1) (define TILE-QUEUED 1)
@@ -76,9 +76,7 @@
(queue [int MAX-TILES]) (queue-len int) (queue-pos int) (queue [int MAX-TILES]) (queue-len int) (queue-pos int)
(free-slots [int MAX-TILES]) (free-count int) (free-slots [int MAX-TILES]) (free-count int)
(settings world-settings) (rivers river-config) (assets-dir [char 1024]) (generation int) (settings world-settings) (rivers river-config) (assets-dir [char 1024]) (generation int)
;; TODO sex#60: size with MAX-WORKERS once arrays of a header type (workers [pthread-t MAX-WORKERS]) (worker-count int) (quit bool) (frame u64) (waiting int)
;; take a symbolic size.
(workers [pthread-t 32]) (worker-count int) (quit bool) (frame u64) (waiting int)
(palette [u32 256]))) (palette [u32 256])))
(fn key-hash ((k tile-key)) u64 (fn key-hash ((k tile-key)) u64