Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Nov 15, 2021
0 parents commit b71f818
Show file tree
Hide file tree
Showing 10 changed files with 391 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

calcit.cirru -diff linguist-generated
Cargo.lock -diff linguist-generated
36 changes: 36 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
on:
push:
branches:
- master
- main
pull_request: {}

name: Test

jobs:
build_and_test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: ACTIONS_ALLOW_UNSECURE_COMMANDS
id: ACTIONS_ALLOW_UNSECURE_COMMANDS
run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV

- name: add cr
run: |
mkdir -p $GITHUB_WORKSPACE/bin
wget -O $GITHUB_WORKSPACE/bin/cr http://repo.calcit-lang.org/binaries/linux/cr
chmod +x $GITHUB_WORKSPACE/bin/cr
echo "::add-path::$GITHUB_WORKSPACE/bin"
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- run: cargo build --release

- run: mkdir dylibs/ && ls target/release/ && cp -v target/release/*.* dylibs/

- run: cr -1
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

/target


# Added by cargo
#
# already existing elements were commented out

#/target

.calcit-error.cirru
.compact-inc.cirru

/dylibs/
40 changes: 40 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "calcit_std"
version = "0.0.1"
authors = ["jiyinyiyong <[email protected]>"]
edition = "2018"

[lib]
name = "calcit_std"
path = "src/lib.rs"
crate-type = ["dylib"] # Creates dynamic lib


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cirru_edn = "0.2.8"
cirru_parser = "0.1.12"
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Workflow

> Rust library for Calcit runtime.
API 设计: https://github.com/calcit-lang/calcit_runner.rs/discussions/116 .

### Usages

APIs:

```cirru
lib.core/path-exists? a
```

Install to `~/.config/calcit/modules/`, compile and provide `*.{dylib,so}` file with `./build.sh`.

### Workflow

https://github.com/calcit-lang/dylib-workflow

### License

MIT
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

cargo build --release
mkdir -p dylibs/ && ls target/release/ && cp -v target/release/*.* dylibs/
194 changes: 194 additions & 0 deletions calcit.cirru

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions compact.cirru
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

{} (:package |lib)
:configs $ {} (:init-fn |lib.test/main!) (:reload-fn |lib.test/reload!)
:modules $ []
:version |0.0.1
:files $ {}
|lib.core $ {}
:ns $ quote
ns lib.core $ :require
lib.$meta :refer $ calcit-dirname
lib.util :refer $ get-dylib-path
:defs $ {}
|path-exists? $ quote
defn path-exists? (name)
&call-dylib-edn (get-dylib-path "\"/dylibs/libcalcit_std") "\"path_exists" name
|lib.test $ {}
:ns $ quote
ns lib.test $ :require
lib.core :refer $ path-exists?
lib.$meta :refer $ calcit-dirname calcit-filename
:defs $ {}
|run-tests $ quote
defn run-tests () (println "\"%%%% test for lib") (println calcit-filename calcit-dirname)
println (path-exists? "\"README.md") (path-exists? "\"build.js")
|main! $ quote
defn main! () $ run-tests
|reload! $ quote
defn reload! $
|lib.util $ {}
:ns $ quote
ns lib.util $ :require
lib.$meta :refer $ calcit-dirname calcit-filename
:defs $ {}
|get-dylib-ext $ quote
defmacro get-dylib-ext () $ case-default (&get-os) "\".so" (:macos "\".dylib") (:windows "\".dll")
|get-dylib-path $ quote
defn get-dylib-path (p)
str (or-current-path calcit-dirname) p $ get-dylib-ext
|or-current-path $ quote
defn or-current-path (p)
if (blank? p) "\"." p
Loading

0 comments on commit b71f818

Please sign in to comment.