Skip to content

Commit b71f818

Browse files
committed
Initial commit
0 parents  commit b71f818

File tree

10 files changed

+391
-0
lines changed

10 files changed

+391
-0
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
calcit.cirru -diff linguist-generated
3+
Cargo.lock -diff linguist-generated

.github/workflows/check.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- main
6+
pull_request: {}
7+
8+
name: Test
9+
10+
jobs:
11+
build_and_test:
12+
name: Test
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: ACTIONS_ALLOW_UNSECURE_COMMANDS
18+
id: ACTIONS_ALLOW_UNSECURE_COMMANDS
19+
run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV
20+
21+
- name: add cr
22+
run: |
23+
mkdir -p $GITHUB_WORKSPACE/bin
24+
wget -O $GITHUB_WORKSPACE/bin/cr http://repo.calcit-lang.org/binaries/linux/cr
25+
chmod +x $GITHUB_WORKSPACE/bin/cr
26+
echo "::add-path::$GITHUB_WORKSPACE/bin"
27+
28+
- uses: actions-rs/toolchain@v1
29+
with:
30+
toolchain: stable
31+
32+
- run: cargo build --release
33+
34+
- run: mkdir dylibs/ && ls target/release/ && cp -v target/release/*.* dylibs/
35+
36+
- run: cr -1

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
/target
3+
4+
5+
# Added by cargo
6+
#
7+
# already existing elements were commented out
8+
9+
#/target
10+
11+
.calcit-error.cirru
12+
.compact-inc.cirru
13+
14+
/dylibs/

Cargo.lock

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "calcit_std"
3+
version = "0.0.1"
4+
authors = ["jiyinyiyong <[email protected]>"]
5+
edition = "2018"
6+
7+
[lib]
8+
name = "calcit_std"
9+
path = "src/lib.rs"
10+
crate-type = ["dylib"] # Creates dynamic lib
11+
12+
13+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
14+
15+
[dependencies]
16+
cirru_edn = "0.2.8"
17+
cirru_parser = "0.1.12"

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Workflow
2+
3+
> Rust library for Calcit runtime.
4+
5+
API 设计: https://github.com/calcit-lang/calcit_runner.rs/discussions/116 .
6+
7+
### Usages
8+
9+
APIs:
10+
11+
```cirru
12+
lib.core/path-exists? a
13+
```
14+
15+
Install to `~/.config/calcit/modules/`, compile and provide `*.{dylib,so}` file with `./build.sh`.
16+
17+
### Workflow
18+
19+
https://github.com/calcit-lang/dylib-workflow
20+
21+
### License
22+
23+
MIT

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
cargo build --release
3+
mkdir -p dylibs/ && ls target/release/ && cp -v target/release/*.* dylibs/

calcit.cirru

Lines changed: 194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compact.cirru

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
{} (:package |lib)
3+
:configs $ {} (:init-fn |lib.test/main!) (:reload-fn |lib.test/reload!)
4+
:modules $ []
5+
:version |0.0.1
6+
:files $ {}
7+
|lib.core $ {}
8+
:ns $ quote
9+
ns lib.core $ :require
10+
lib.$meta :refer $ calcit-dirname
11+
lib.util :refer $ get-dylib-path
12+
:defs $ {}
13+
|path-exists? $ quote
14+
defn path-exists? (name)
15+
&call-dylib-edn (get-dylib-path "\"/dylibs/libcalcit_std") "\"path_exists" name
16+
|lib.test $ {}
17+
:ns $ quote
18+
ns lib.test $ :require
19+
lib.core :refer $ path-exists?
20+
lib.$meta :refer $ calcit-dirname calcit-filename
21+
:defs $ {}
22+
|run-tests $ quote
23+
defn run-tests () (println "\"%%%% test for lib") (println calcit-filename calcit-dirname)
24+
println (path-exists? "\"README.md") (path-exists? "\"build.js")
25+
|main! $ quote
26+
defn main! () $ run-tests
27+
|reload! $ quote
28+
defn reload! $
29+
|lib.util $ {}
30+
:ns $ quote
31+
ns lib.util $ :require
32+
lib.$meta :refer $ calcit-dirname calcit-filename
33+
:defs $ {}
34+
|get-dylib-ext $ quote
35+
defmacro get-dylib-ext () $ case-default (&get-os) "\".so" (:macos "\".dylib") (:windows "\".dll")
36+
|get-dylib-path $ quote
37+
defn get-dylib-path (p)
38+
str (or-current-path calcit-dirname) p $ get-dylib-ext
39+
|or-current-path $ quote
40+
defn or-current-path (p)
41+
if (blank? p) "\"." p

0 commit comments

Comments
 (0)