Skip to content

Commit

Permalink
dramatically simplify example.
Browse files Browse the repository at this point in the history
  • Loading branch information
phronmophobic committed Jul 8, 2024
1 parent a110594 commit b0ceab5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
10 changes: 5 additions & 5 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
:deps {org.clojure/clojure {:mvn/version "1.11.0"}


com.phronemophobic/membrane {:mvn/version "0.9.31.8-beta"
#_#_com.phronemophobic/membrane {:mvn/version "0.9.31.8-beta"
;; :sha "e5d3723a94108dbc0784f07dc423f449a869f8b7"
;; :git/url "https://github.com/phronmophobic/membrane"
;; :local/root "../membrane"
}

borkdude/sci {:mvn/version "0.2.7"
#_#_borkdude/sci {:mvn/version "0.2.7"
;; :local/root "../sci"
}
com.phronemophobic/scify {:mvn/version "1.0"}

org.clojure/data.json {:mvn/version "2.4.0"}

babashka/babashka.nrepl {:mvn/version "0.0.6"}
babashka/babashka { ;; :sha "7e65ec2fa8e663c2ba9a74a3d6280c4cb0e9b274"
#_#_babashka/babashka.nrepl {:mvn/version "0.0.6"}
#_#_babashka/babashka { ;; :sha "7e65ec2fa8e663c2ba9a74a3d6280c4cb0e9b274"
;; :git/url "https://github.com/phronmophobic/babashka"
;; :local/root "../babashka"
:mvn/version "0.7.8"
}

com.phronemophobic/clj-objc { ;; :local/root "../clj-objc"
#_#_com.phronemophobic/clj-objc { ;; :local/root "../clj-objc"
:sha "76efd79cd741a65b5d2ebe92453d482e4eb39703"
:git/url "https://github.com/phronmophobic/clj-objc.git"
}
Expand Down
5 changes: 3 additions & 2 deletions scripts/compile-shared
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ df -h
top -l 1 | grep PhysMem
clang --version

find ./tmp -name 'bb.o' -exec cp {} build/out \;
# find ./tmp -name 'grease-uber.o' -exec cp {} build/out \;
# find ./tmp -name 'bb.o' -exec cp {} build/out \;
find ./tmp -name 'grease-uber.o' -exec cp {} build/out \;
mv build/out/grease-uber.o build/out/bb.o

ls -l ./build/out/bb.o
file ./build/out/bb.o
Expand Down
20 changes: 11 additions & 9 deletions src/com/phronemophobic/grease.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(ns com.phronemophobic.grease
(:require [tech.v3.datatype.ffi :as dt-ffi]
[sci.core :as sci]
[sci.addons :as addons]
babashka.nrepl.server)
#_[sci.core :as sci]
#_[sci.addons :as addons]
;;babashka.nrepl.server
)
(:import org.graalvm.nativeimage.c.function.CEntryPointLiteral
tech.v3.datatype.ffi.Pointer
org.graalvm.word.WordBase)
Expand Down Expand Up @@ -44,18 +45,19 @@
(prn (get-result id)))

(defn clj_eval [bs]
(add-result (sci/eval-string (dt-ffi/c->string bs))))
42
#_(add-result (sci/eval-string (dt-ffi/c->string bs))))

(defn clj_print_hi []
(println "hi"))

(def opts (-> {:classes {'System java.lang.System}
:namespaces {'foo.bar {'x 1}}}
addons/future))
(def sci-ctx (sci/init opts))
;; (def opts (-> {:classes {'System java.lang.System}
;; :namespaces {'foo.bar {'x 1}}}
;; addons/future))
;; (def sci-ctx (sci/init opts))

(defn clj_start_server []
(babashka.nrepl.server/start-server! sci-ctx {:host "0.0.0.0" :port 23456}))
#_(babashka.nrepl.server/start-server! sci-ctx {:host "0.0.0.0" :port 23456}))

(defn clj_callback_fn []
(println "hello callback"))
Expand Down

0 comments on commit b0ceab5

Please sign in to comment.