1.1--- a/Cargo.toml Sun Apr 30 22:25:43 2023 -0400
1.2+++ b/Cargo.toml Fri May 05 22:41:30 2023 -0400
1.3@@ -1,5 +1,5 @@
1.4 [package]
1.5-name = "cl-demo-rs"
1.6+name = "demo_ffi"
1.7 version = "0.1.0"
1.8 edition = "2021"
1.9 build = "build.rs"
1.10@@ -7,10 +7,10 @@
1.11 path = "lib.rs"
1.12 crate-type = ["cdylib"]
1.13 [workspace]
1.14-members = ["cfg","obj"]
1.15+members = ["obj","fig","proc_macros"]
1.16 [dependencies]
1.17 libc = "0.2"
1.18 obj = {version = "0.1.0",path = "obj"}
1.19-cfg = {version = "0.1.0",path = "cfg"}
1.20+fig = {version = "0.1.0",path = "fig"}
1.21 [build-dependencies]
1.22 cbindgen = "0.20"
1.23\ No newline at end of file
2.1--- a/cfg/Cargo.toml Sun Apr 30 22:25:43 2023 -0400
2.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
2.3@@ -1,7 +0,0 @@
2.4-[package]
2.5-name = "cfg"
2.6-version = "0.1.0"
2.7-edition = "2021"
2.8-[dependencies]
2.9-obj = {version = "0.1.0",path = "../obj"}
2.10-serde_dhall = "0.12.1"
3.1--- a/cfg/src/lib.rs Sun Apr 30 22:25:43 2023 -0400
3.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3@@ -1,4 +0,0 @@
3.4-//! cfg/src/lib.rs --- Configuration types
3.5-
3.6-#[cfg(test)]
3.7-mod tests;
4.1--- a/cfg/src/tests.rs Sun Apr 30 22:25:43 2023 -0400
4.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
4.3@@ -1,6 +0,0 @@
4.4-//! cfg/src/tests --- unit tests
4.5-use crate::*;
4.6-#[test]
4.7-fn test_hello() {
4.8- println!("looks good chief");
4.9-}
5.1--- a/cl-demo.asd Sun Apr 30 22:25:43 2023 -0400
5.2+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3@@ -1,37 +0,0 @@
5.4-(asdf:defsystem "cl-demo"
5.5- :version "1.0.0"
5.6- :author "ellis <ellis@rwest.io>"
5.7- :maintainer "ellis <ellis@rwest.io>"
5.8- :description ""
5.9- :homepage "https://rwest.io/p/cl-demo"
5.10- :bug-tracker "https://gitlab.rwest.io/ellis/cl-demo/issues"
5.11- :source-control (:hg "https://gitlab.rwest.io/ellis/cl-demo")
5.12- :license "WTFPL"
5.13- :depends-on (:bordeaux-threads
5.14- #+(or ccl sbcl)
5.15- :clack
5.16- :caveman2
5.17- :clog
5.18- :cl-rocksdb
5.19- :verbose
5.20- :alexandria
5.21- :cl-ppcre
5.22- :cffi
5.23- :clingon)
5.24- :serial T
5.25- :components ((:file "pkg")
5.26- (:file "tk")
5.27- (:file "db")
5.28- (:file "ui")
5.29- (:file "demo"))
5.30- ;; :in-order-to ((test-op (test-op "cl-demo/tests")))
5.31- ;; :defsystem-depends-on (:deploy)
5.32- ;; :build-operation "deploy"
5.33- :build-pathname "cl-demo"
5.34- :entry-point "cl-demo:main")
5.35-
5.36-;; (asdf:defsystem "cl-demo:tests"
5.37- ;; :depends-on ("cl-demo" "fiveam")
5.38- ;; :components ((:file "tests"))
5.39- ;; :perform (test-op (o c) (symbol-call :fiveam '#:run! :cl-demo))
5.40- ;; )
6.1--- a/db.lisp Sun Apr 30 22:25:43 2023 -0400
6.2+++ b/db.lisp Fri May 05 22:41:30 2023 -0400
6.3@@ -1,2 +1,1 @@
6.4-(in-package :cl-demo)
6.5-
6.6+(in-package :demo)
7.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2+++ b/demo.asd Fri May 05 22:41:30 2023 -0400
7.3@@ -0,0 +1,38 @@
7.4+(asdf:defsystem "demo"
7.5+ :version "1.0.0"
7.6+ :author "ellis <ellis@rwest.io>"
7.7+ :maintainer "ellis <ellis@rwest.io>"
7.8+ :description ""
7.9+ :homepage "https://rwest.io/p/demo"
7.10+ :bug-tracker "https://gitlab.rwest.io/ellis/demo/issues"
7.11+ :source-control (:hg "https://gitlab.rwest.io/ellis/demo")
7.12+ :license "WTFPL"
7.13+ :depends-on (:bordeaux-threads
7.14+ #+(or ccl sbcl)
7.15+ :clack
7.16+ :caveman2
7.17+ :clog
7.18+ :cl-rocksdb
7.19+ :verbose
7.20+ :alexandria
7.21+ :cl-ppcre
7.22+ :cffi
7.23+ :clingon)
7.24+ :serial T
7.25+ :components ((:file "pkg")
7.26+ (:file "ffi")
7.27+ (:file "tk")
7.28+ (:file "db")
7.29+ (:file "ui")
7.30+ (:file "demo"))
7.31+ ;; :in-order-to ((test-op (test-op "demo/tests")))
7.32+ ;; :defsystem-depends-on (:deploy)
7.33+ ;; :build-operation "deploy"
7.34+ :build-pathname "demo"
7.35+ :entry-point "demo:main")
7.36+
7.37+;; (asdf:defsystem "cl-demo:tests"
7.38+ ;; :depends-on ("cl-demo" "fiveam")
7.39+ ;; :components ((:file "tests"))
7.40+ ;; :perform (test-op (o c) (symbol-call :fiveam '#:run! :cl-demo))
7.41+ ;; )
8.1--- a/demo.lisp Sun Apr 30 22:25:43 2023 -0400
8.2+++ b/demo.lisp Fri May 05 22:41:30 2023 -0400
8.3@@ -1,5 +1,5 @@
8.4 ;; demo.lisp
8.5-(in-package :cl-demo)
8.6+(in-package :demo)
8.7
8.8 (defparameter demo-path (merge-pathnames "cl-demo" (uiop:temporary-directory)))
8.9
8.10@@ -20,7 +20,7 @@
8.11 (defun cli-handler (cmd)
8.12 "Handler for the `demo' command."
8.13 (let ((app (cli:getopt cmd :app)))
8.14- (format t "running app: ~A!~%" app)))
8.15+ (format t "running: ~A!~%" app)))
8.16
8.17 (defun cli-cmd ()
8.18 "Our demo command."
8.19@@ -30,9 +30,9 @@
8.20 :version "1.0.0"
8.21 :authors '("ellis <ellis@rwest.io>")
8.22 :license "WTFPL"
8.23- :options (demo/opts)
8.24- :handler #'demo/handler))
8.25+ :options (cli-opts)
8.26+ :handler #'cli-handler))
8.27
8.28 (defun main ()
8.29 "A demo of some common-lisp functionality."
8.30- (cli:run (demo/cmd)))
8.31+ (cli:run (cli-cmd)))
9.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2+++ b/ffi.lisp Fri May 05 22:41:30 2023 -0400
9.3@@ -0,0 +1,8 @@
9.4+(in-package :demo)
9.5+
9.6+(define-foreign-library demo_ffi
9.7+ (:win32 (:default "./target/release/demo_ffi"))
9.8+ (t (:default "./target/release/libdemo_ffi")))
9.9+
9.10+(use-foreign-library demo_ffi)
9.11+
10.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2+++ b/fig/Cargo.toml Fri May 05 22:41:30 2023 -0400
10.3@@ -0,0 +1,7 @@
10.4+[package]
10.5+name = "fig"
10.6+version = "0.1.0"
10.7+edition = "2021"
10.8+[dependencies]
10.9+obj = {version = "0.1.0",path = "../obj"}
10.10+serde_dhall = "0.12.1"
11.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2+++ b/fig/src/lib.rs Fri May 05 22:41:30 2023 -0400
11.3@@ -0,0 +1,3 @@
11.4+//! fig/src/lib.rs --- Configuration types
11.5+#[cfg(test)]
11.6+mod tests;
12.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2+++ b/fig/src/tests.rs Fri May 05 22:41:30 2023 -0400
12.3@@ -0,0 +1,6 @@
12.4+//! cfg/src/tests --- unit tests
12.5+use crate::*;
12.6+#[test]
12.7+fn test_hello() {
12.8+ println!("looks good chief");
12.9+}
13.1--- a/lib.rs Sun Apr 30 22:25:43 2023 -0400
13.2+++ b/lib.rs Fri May 05 22:41:30 2023 -0400
13.3@@ -1,1 +1,3 @@
13.4-//! cl-demo-rs
13.5+//! demo_ffi
13.6+pub use obj::Service;
13.7+pub use fig;
14.1--- a/makefile Sun Apr 30 22:25:43 2023 -0400
14.2+++ b/makefile Fri May 05 22:41:30 2023 -0400
14.3@@ -1,5 +1,5 @@
14.4 L ?= sbcl
14.5-O ?= /tmp/cl-demo
14.6+O ?= /tmp/demo
14.7 .PHONY:build
14.8 $(O):;mkdir -p $@
14.9 clean:;rm -rf out *.fasl;cargo clean
14.10@@ -7,4 +7,5 @@
14.11 docs:;scripts/docs.ros
14.12 test:;scripts/test.ros
14.13 pack:;scripts/pack.ros
14.14+check:;scripts/check.ros
14.15 ci:clean build docs test pack;
15.1--- a/obj/Cargo.toml Sun Apr 30 22:25:43 2023 -0400
15.2+++ b/obj/Cargo.toml Fri May 05 22:41:30 2023 -0400
15.3@@ -8,9 +8,9 @@
15.4 serde_json = "1.0.68"
15.5 serde = { version = "1.0.130", features = ["derive"] }
15.6 chrono = { version = "0.4.19", features = ["serde"] }
15.7-mime = "0.3.16"
15.8+# mime = "0.3.16"
15.9 regex = "1.5.4"
15.10-rusty_ulid = "0.11.0"
15.11+# rusty_ulid = "0.11.0"
15.12 uuid = { version = "0.8", features = ["serde"] }
15.13 [target.'cfg(target_arch = "wasm32")'.dependencies]
15.14 uuid = { version = "0.8", features = ["wasm-bindgen"] }
16.1--- a/obj/src/lib.rs Sun Apr 30 22:25:43 2023 -0400
16.2+++ b/obj/src/lib.rs Fri May 05 22:41:30 2023 -0400
16.3@@ -1,12 +1,17 @@
16.4 //! obj/src/lib.rs --- Objective type library
16.5+#![feature(associated_type_bounds)]
16.6 mod err;
16.7-pub use err::{Error,Result};
16.8+pub use err::{Error, Result};
16.9+mod types;
16.10+pub use types::*;
16.11
16.12 pub use ron;
16.13-
16.14+pub use bincode;
16.15+pub use serde_json;
16.16 use ron::extensions::Extensions;
16.17 use serde::{de::DeserializeOwned, Deserialize, Serialize};
16.18 use std::io;
16.19+use std::collections::{HashMap, BTreeMap};
16.20
16.21 /// common trait for all config modules. This trait provides functions
16.22 /// for de/serializing to/from RON, updating fields, and formatting.
16.23@@ -123,3 +128,7 @@
16.24 Ok(serde_json::de::from_slice(s.as_bytes())?)
16.25 }
16.26 }
16.27+
16.28+impl<T> Objective for Vec<T> {}
16.29+impl<K,V> Objective for HashMap<K,V> {}
16.30+impl<K,V> Objective for BTreeMap<K,V> {}
17.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2+++ b/obj/src/types.rs Fri May 05 22:41:30 2023 -0400
17.3@@ -0,0 +1,23 @@
17.4+//! obj/src/types.rs --- OBJ type descriptions used by our demo
17.5+use crate::{Error, Result, Objective, Serialize, Deserialize};
17.6+/// APPLICATION TYPES
17.7+#[derive(Serialize, Deserialize)]
17.8+pub enum Service {
17.9+ Nws,
17.10+ Fin,
17.11+ Pvp,
17.12+}
17.13+
17.14+impl Objective for Service {}
17.15+
17.16+#[derive(Serialize, Deserialize)]
17.17+pub struct Complex<X: Objective> {
17.18+ data: X,
17.19+ state: Vec<u8>,
17.20+}
17.21+
17.22+impl Objective for Complex<Service> {}
17.23+
17.24+pub fn generate_complex() -> Result<Complex<Service>> {
17.25+ Ok(Complex::<Service>::from_json_str("hi")?)
17.26+}
18.1--- a/pkg.lisp Sun Apr 30 22:25:43 2023 -0400
18.2+++ b/pkg.lisp Fri May 05 22:41:30 2023 -0400
18.3@@ -1,11 +1,10 @@
18.4 #|
18.5-cl-demo
18.6+demo
18.7
18.8-> (cl-demo:main)
18.9+> (demo:main)
18.10 |#
18.11-
18.12-(defpackage #:cl-demo
18.13- (:use #:cl)
18.14+(defpackage #:demo
18.15+ (:use #:cl #:cffi)
18.16 (:local-nicknames
18.17 (#:rdb #:cl-rocksdb)
18.18 (#:v #:org.shirakumo.verbose)
18.19@@ -32,4 +31,6 @@
18.20 ;; tk.lisp
18.21 (:export
18.22 #:random-id
18.23- #:scan-dir))
18.24+ #:scan-dir)
18.25+ ;; ffi.lisp
18.26+ )
19.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2+++ b/proc_macros/Cargo.toml Fri May 05 22:41:30 2023 -0400
19.3@@ -0,0 +1,12 @@
19.4+[package]
19.5+name = "proc_macros"
19.6+version = "0.1.0"
19.7+edition = "2021"
19.8+
19.9+[lib]
19.10+proc-macro = true
19.11+
19.12+[dependencies]
19.13+quote = "1.0"
19.14+proc-macro2 = "1.0"
19.15+syn = "1.0"
19.16\ No newline at end of file
20.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2+++ b/proc_macros/src/derive.rs Fri May 05 22:41:30 2023 -0400
20.3@@ -0,0 +1,5 @@
20.4+mod derive;
20.5+use proc_macro::TokenStream;
20.6+pub fn derive_static_type(input: TokenStream) -> TokenStream {
20.7+ derive::derive_static_type(input)
20.8+}
22.1--- a/readme.org Sun Apr 30 22:25:43 2023 -0400
22.2+++ b/readme.org Fri May 05 22:41:30 2023 -0400
22.3@@ -1,8 +1,10 @@
22.4 #+TITTLE: cl-demo
22.5
22.6 This is a demo software suite which showcases the power of Common Lisp and Rust.
22.7-
22.8 * Make
22.9 * Run
22.10 * Play
22.11 * Config
22.12+* COMMENT tasks
22.13+** TODO proc_macros
22.14+** TODO ros scripts
23.1--- a/scripts/compile.ros Sun Apr 30 22:25:43 2023 -0400
23.2+++ b/scripts/compile.ros Fri May 05 22:41:30 2023 -0400
23.3@@ -6,9 +6,7 @@
23.4 (progn ;;init forms
23.5 (in-package :cl-user)
23.6 (ros:ensure-asdf)
23.7- (asdf:load-asd #P"~/dev/cl-demo/cl-demo.asd")
23.8- (asdf:load-asd #P"~/quicklisp/local-projects/cl-rocksdb/cl-rocksdb.asd")
23.9- #+quicklisp(ql:quickload '(cl-demo) :silent t))
23.10+ #+quicklisp(ql:quickload '(demo) :silent t))
23.11
23.12 ;; TODO 2023-02-25: opts (system, config, user input)
23.13 (defun main (&rest argv)
24.1--- a/scripts/demo.ros Sun Apr 30 22:25:43 2023 -0400
24.2+++ b/scripts/demo.ros Fri May 05 22:41:30 2023 -0400
24.3@@ -5,8 +5,8 @@
24.4 |#
24.5 (progn ;;init forms
24.6 (ros:ensure-asdf)
24.7- #+quicklisp(ql:quickload '() :silent t))
24.8+ #+quicklisp(ql:quickload '(demo) :silent t))
24.9
24.10 (defun main (&rest argv)
24.11 (declare (ignorable argv))
24.12- (format t "hello world"))
24.13\ No newline at end of file
24.14+ (format t "hello world"))
27.1--- a/tests.lisp Sun Apr 30 22:25:43 2023 -0400
27.2+++ b/tests.lisp Fri May 05 22:41:30 2023 -0400
27.3@@ -1,1 +1,1 @@
27.4-(in-package :cl-demo)
27.5+(in-package :demo)
28.1--- a/tk.lisp Sun Apr 30 22:25:43 2023 -0400
28.2+++ b/tk.lisp Fri May 05 22:41:30 2023 -0400
28.3@@ -1,4 +1,4 @@
28.4-(in-package #:cl-demo)
28.5+(in-package #:demo)
28.6
28.7 (defun random-id ()
28.8 (format NIL "~8,'0x-~8,'0x" (random #xFFFFFFFF) (get-universal-time)))
29.1--- a/ui.lisp Sun Apr 30 22:25:43 2023 -0400
29.2+++ b/ui.lisp Fri May 05 22:41:30 2023 -0400
29.3@@ -1,4 +1,4 @@
29.4-(in-package :cl-demo)
29.5+(in-package :demo)
29.6
29.7 (defun on-new-window (body)
29.8 "Handle new window event."