diff --git a/host/chez/build.ss b/host/chez/build.ss index bb36752..9f789a0 100644 --- a/host/chez/build.ss +++ b/host/chez/build.ss @@ -111,7 +111,7 @@ 'compile-eval "(load \"host/chez/png.ss\")" "(load \"host/chez/loader.ss\")" - "(load \"host/chez/ffi.ss\")" + "(load \"host/chez/java/ffi.ss\")" "(set-source-roots! (list \"jolt-core\" \"stdlib\"))")) (define bld-tagged-loads diff --git a/host/chez/cli.ss b/host/chez/cli.ss index 9f597cb..1d03c82 100644 --- a/host/chez/cli.ss +++ b/host/chez/cli.ss @@ -24,7 +24,7 @@ ;; jolt.ffi host primitives (memory / library loading) load AFTER the loader's ;; baked-ns snapshot, so a library's (require '[jolt.ffi]) still loads jolt.ffi's ;; Clojure side (the foreign-fn / defcfn macros, stdlib/jolt/ffi.clj). -(load "host/chez/ffi.ss") ; jolt.ffi (FFI: a library binds native code) +(load "host/chez/java/ffi.ss") ; jolt.ffi (FFI: a library binds native code) ;; jolt.main + jolt.deps live under jolt-core; keep them (and stdlib) on the ;; roots so the CLI's own namespaces — and any jolt.* an app pulls in — resolve. diff --git a/host/chez/async.ss b/host/chez/java/async.ss similarity index 100% rename from host/chez/async.ss rename to host/chez/java/async.ss diff --git a/host/chez/bigdec.ss b/host/chez/java/bigdec.ss similarity index 100% rename from host/chez/bigdec.ss rename to host/chez/java/bigdec.ss diff --git a/host/chez/byte-buffer.ss b/host/chez/java/byte-buffer.ss similarity index 100% rename from host/chez/byte-buffer.ss rename to host/chez/java/byte-buffer.ss diff --git a/host/chez/concurrency.ss b/host/chez/java/concurrency.ss similarity index 100% rename from host/chez/concurrency.ss rename to host/chez/java/concurrency.ss diff --git a/host/chez/dot-forms.ss b/host/chez/java/dot-forms.ss similarity index 100% rename from host/chez/dot-forms.ss rename to host/chez/java/dot-forms.ss diff --git a/host/chez/ffi.ss b/host/chez/java/ffi.ss similarity index 100% rename from host/chez/ffi.ss rename to host/chez/java/ffi.ss diff --git a/host/chez/host-class.ss b/host/chez/java/host-class.ss similarity index 100% rename from host/chez/host-class.ss rename to host/chez/java/host-class.ss diff --git a/host/chez/host-static-classes.ss b/host/chez/java/host-static-classes.ss similarity index 100% rename from host/chez/host-static-classes.ss rename to host/chez/java/host-static-classes.ss diff --git a/host/chez/host-static-methods.ss b/host/chez/java/host-static-methods.ss similarity index 100% rename from host/chez/host-static-methods.ss rename to host/chez/java/host-static-methods.ss diff --git a/host/chez/host-static.ss b/host/chez/java/host-static.ss similarity index 100% rename from host/chez/host-static.ss rename to host/chez/java/host-static.ss diff --git a/host/chez/inst-time.ss b/host/chez/java/inst-time.ss similarity index 100% rename from host/chez/inst-time.ss rename to host/chez/java/inst-time.ss diff --git a/host/chez/io-streams.ss b/host/chez/java/io-streams.ss similarity index 100% rename from host/chez/io-streams.ss rename to host/chez/java/io-streams.ss diff --git a/host/chez/io.ss b/host/chez/java/io.ss similarity index 100% rename from host/chez/io.ss rename to host/chez/java/io.ss diff --git a/host/chez/java-time.ss b/host/chez/java/java-time.ss similarity index 100% rename from host/chez/java-time.ss rename to host/chez/java/java-time.ss diff --git a/host/chez/math.ss b/host/chez/java/math.ss similarity index 100% rename from host/chez/math.ss rename to host/chez/java/math.ss diff --git a/host/chez/natives-array.ss b/host/chez/java/natives-array.ss similarity index 100% rename from host/chez/natives-array.ss rename to host/chez/java/natives-array.ss diff --git a/host/chez/natives-queue.ss b/host/chez/java/natives-queue.ss similarity index 100% rename from host/chez/natives-queue.ss rename to host/chez/java/natives-queue.ss diff --git a/host/chez/natives-str.ss b/host/chez/java/natives-str.ss similarity index 100% rename from host/chez/natives-str.ss rename to host/chez/java/natives-str.ss diff --git a/host/chez/records-interop.ss b/host/chez/java/records-interop.ss similarity index 100% rename from host/chez/records-interop.ss rename to host/chez/java/records-interop.ss diff --git a/host/chez/rt.ss b/host/chez/rt.ss index 04b23ae..30929e7 100644 --- a/host/chez/rt.ss +++ b/host/chez/rt.ss @@ -259,7 +259,7 @@ ;; the dispatchers/printers it wraps (collections/seq/values/converters/printing/ ;; transients). (load "host/chez/records.ss") -(load "host/chez/records-interop.ss") ; exception hierarchy + instance-check taxonomy +(load "host/chez/java/records-interop.ss") ; exception hierarchy + instance-check taxonomy ;; metadata: meta / with-meta over an identity-keyed ;; side-table. After records.ss (jrec) + the collection ctors it copies. @@ -268,7 +268,7 @@ ;; host class tokens: bare class names (String/Keyword/File...) -> ;; canonical JVM class-name strings + (class x). After natives-meta.ss (jolt-type) ;; and the printer (jolt-str-render-one). -(load "host/chez/host-class.ss") +(load "host/chez/java/host-class.ss") ;; dynamic vars: *clojure-version* / *unchecked-math* constants the host ;; binds natively. After collections.ss (jolt-hash-map) + def-var!. @@ -324,39 +324,39 @@ ;; portable String/CharSequence surface record-method-dispatch falls through to on ;; a string target. After regex.ss (jolt-re-pattern/regex-t-irx) + records.ss ;; (which references jolt-string-method). -(load "host/chez/natives-str.ss") +(load "host/chez/java/natives-str.ss") ;; host class statics + constructors: host-static-ref/ ;; host-static-call/host-new + the jhost method registry. Loads LAST — it extends ;; record-method-dispatch (records.ss) and reuses natives-str helpers (str-trim, ;; ascii-string-down, re-split, str-split-drop-trailing) + the regex-t accessors. -(load "host/chez/host-static.ss") ; registries + jhost + coercion helpers -(load "host/chez/host-static-methods.ss") ; Class/member static methods + fields -(load "host/chez/host-static-classes.ss") ; instantiable host object classes -(load "host/chez/byte-buffer.ss") ; java.nio.ByteBuffer over a byte-array +(load "host/chez/java/host-static.ss") ; registries + jhost + coercion helpers +(load "host/chez/java/host-static-methods.ss") ; Class/member static methods + fields +(load "host/chez/java/host-static-classes.ss") ; instantiable host object classes +(load "host/chez/java/byte-buffer.ss") ; java.nio.ByteBuffer over a byte-array ;; generic dot-form dispatch: field access + map/vector member access ;; for the `.` / `.-field` desugar. Loads after host-static.ss so it wraps every ;; record-method-dispatch arm (jhost/number/regex/jrec/string) and falls through. -(load "host/chez/dot-forms.ss") +(load "host/chez/java/dot-forms.ss") ;; java.io.File + host file I/O: path-backed jfile record, slurp/spit/ ;; flush, file-seq dir primitives, clojure.java.io/file. Loads LAST so its jfile ;; arm wraps the fully-built record-method-dispatch and the str/type/instance-check ;; extensions sit over every prior shim. -(load "host/chez/io.ss") +(load "host/chez/java/io.ss") ;; #inst values + java.time formatting: jinst (RFC3339 ms) + ;; DateTimeFormatter/Instant/ZoneId/LocalDateTime/FormatStyle/Locale/Date. Loads ;; LAST — it extends record-method-dispatch / jolt-get / jolt= / jolt-hash / ;; jolt-pr-str / jolt-type / instance-check and uses host-static.ss's registries. -(load "host/chez/inst-time.ss") +(load "host/chez/java/inst-time.ss") ;; java.time value types: LocalDate / LocalTime / LocalDateTime / Instant as ;; tz-free jhost values (epoch-day / nano-of-day / epoch-ms). Loads after ;; inst-time.ss — it reuses its civil<->days helpers, the jhost registries, and ;; re-registers a few LocalDateTime/Instant statics to use the richer reps. -(load "host/chez/java-time.ss") +(load "host/chez/java/java-time.ss") ;; Chez-side data reader: read-string / __parse-next / ;; __read-tagged. Loads after inst-time.ss — __read-tagged reuses its #uuid/#inst @@ -365,7 +365,7 @@ ;; clojure.math: native flonum-math shims def-var!'d into the ;; clojure.math ns. Self-contained (only def-var! + Chez math), order-independent. -(load "host/chez/math.ss") +(load "host/chez/java/math.ss") ;; reader/macro runtime support: #?() feature set, reader-conditional + re-matcher ;; tagged-map ctors, macroexpand. After ns.ss; macroexpand call-time-refs the macro @@ -375,17 +375,17 @@ ;; Java-style arrays: object/typed array constructors + a jolt-array ;; backing; extends count/nth/seq/get/ref-put! so the overlay aget/aset/alength see ;; it. After the dispatchers it chains. -(load "host/chez/natives-array.ss") +(load "host/chez/java/natives-array.ss") ;; java.io byte/char streams (FileInputStream/…/ByteArrayOutputStream/Buffered*) ;; over Chez ports. After io.ss (extends its slurp/__close/reader-jhost?) and ;; natives-array.ss (the byte-array <-> bytevector bridge). -(load "host/chez/io-streams.ss") +(load "host/chez/java/io-streams.ss") ;; clojure.lang.PersistentQueue: a functional queue + EMPTY static. ;; Chains seq/count/empty?/peek/pop/conj/sequential?/class/instance?/printer, so ;; load after natives-array (the dispatchers it extends). -(load "host/chez/natives-queue.ss") +(load "host/chez/java/natives-queue.ss") ;; syntax-quote form builders: __sqcat/__sqvec/__sqmap/__sqset/ ;; __sq1, def-var!'d into clojure.core. A cross-compiled macro expander (analyzer @@ -397,14 +397,14 @@ ;; (JVM) semantics. Loaded LAST — chains the fully-built jolt-deref and conveys the ;; thread-local binding stack (dyn-binding.ss) into workers. pmap/pcalls/pvalues ;; (overlay, over `future`) light up once future-call exists here. -(load "host/chez/concurrency.ss") +(load "host/chez/java/concurrency.ss") ;; clojure.core.async: real-thread blocking channels + go/go-loop/ ;; thread macros, def-var!'d into clojure.core.async. After concurrency.ss (reuses ;; ms->duration) and the collection/seq layer. -(load "host/chez/async.ss") +(load "host/chez/java/async.ss") ;; BigDecimal: the jbigdec value type + bigdec/decimal?/class/equality/ ;; printing. Loads LAST so its set!-wraps of jolt-class/jolt=2/the printers sit ;; outermost over every earlier extension. -(load "host/chez/bigdec.ss") +(load "host/chez/java/bigdec.ss") diff --git a/jolt-core/clojure/core/21-coll.clj b/jolt-core/clojure/core/21-coll.clj index dfaffe4..34e85fa 100644 --- a/jolt-core/clojure/core/21-coll.clj +++ b/jolt-core/clojure/core/21-coll.clj @@ -340,7 +340,7 @@ (defn clojure-version [] "1.11.0-jolt") -;; bigdec is a host fn (host/chez/bigdec.ss) — a real BigDecimal value type. +;; bigdec is a host fn (host/chez/java/bigdec.ss) — a real BigDecimal value type. (defn numerator [x] (throw (ex-info "numerator requires a ratio (Jolt has no ratios)" {}))) (defn denominator [x] (throw (ex-info "denominator requires a ratio (Jolt has no ratios)" {}))) diff --git a/jolt-core/jolt/analyzer.clj b/jolt-core/jolt/analyzer.clj index 38fd559..19b3dd0 100644 --- a/jolt-core/jolt/analyzer.clj +++ b/jolt-core/jolt/analyzer.clj @@ -685,7 +685,7 @@ ;; jolt-regex value over the vendored irregex. (form-regex? form) {:op :regex :source (form-regex-source form)} ;; #inst / #uuid literals -> :inst / :uuid IR leaves. The Chez back - ;; end emits a runtime inst/uuid value (host/chez/inst-time.ss). + ;; end emits a runtime inst/uuid value (host/chez/java/inst-time.ss). (form-inst? form) {:op :inst :source (form-inst-source form)} (form-uuid? form) {:op :uuid :source (form-uuid-source form)} ;; bigdecimal literal (1.5M) -> a :bigdec leaf; the back end emits a runtime diff --git a/jolt-core/jolt/backend_scheme.clj b/jolt-core/jolt/backend_scheme.clj index 6caa704..8478c71 100644 --- a/jolt-core/jolt/backend_scheme.clj +++ b/jolt-core/jolt/backend_scheme.clj @@ -350,7 +350,7 @@ (ffi-type->chez (:rettype node)) ")")) ;; jolt.ffi/__ccallable -> a Chez foreign-callable wrapping the emitted jolt fn, -;; locked + registered (jolt-ffi-register-callable!, host/chez/ffi.ss) so the +;; locked + registered (jolt-ffi-register-callable!, host/chez/java/ffi.ss) so the ;; collector neither moves nor reclaims it while C may still call through it. The ;; expression evaluates to the entry-point address — a jolt pointer the caller ;; hands to C. :collect-safe emits the convention that reactivates the thread on diff --git a/test/chez/ffi-binding-test.ss b/test/chez/ffi-binding-test.ss index b53a178..0454f90 100644 --- a/test/chez/ffi-binding-test.ss +++ b/test/chez/ffi-binding-test.ss @@ -14,7 +14,7 @@ (load "host/chez/host-contract.ss") (load "host/chez/seed/image.ss") (load "host/chez/compile-eval.ss") -(load "host/chez/ffi.ss") +(load "host/chez/java/ffi.ss") (define total 0) (define fails 0) (define (ok name pred) (set! total (+ total 1)) (unless pred (set! fails (+ fails 1)) (printf "FAIL: ~a\n" name)))