Compare commits
35 Commits
69ba2ab715
...
v1.1.3
Author | SHA1 | Date | |
---|---|---|---|
6a025cbf1a
|
|||
8a6c623ef2
|
|||
a1db2b6bb0
|
|||
c2d3e613d4
|
|||
96a34dc05d
|
|||
42fdcd5853
|
|||
cffb3726cc
|
|||
ef74b67f90
|
|||
32463ad6aa | |||
413c34c440 | |||
a1d190b06e
|
|||
178708a4ac
|
|||
5bb8e2c4ce | |||
49b88af2bb
|
|||
a0fe0a9385
|
|||
7215afcc7e
|
|||
3ab559b240
|
|||
810e2a1267
|
|||
798c9ceae9 | |||
572158553c
|
|||
f7602a3011
|
|||
f5b2c5b261
|
|||
0559e84444
|
|||
8dea7e2e8c
|
|||
bcef2c7403
|
|||
fb22243104
|
|||
3fd489dd7e
|
|||
fc2027c657
|
|||
a70fd5f0e5
|
|||
161f184437
|
|||
599c9742d2
|
|||
9f9cc5d084
|
|||
c8ebec59ae
|
|||
bab305e11d | |||
a6c3ffa68d |
3
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
/src/target
|
/src/target
|
||||||
/pkg
|
/pkg
|
||||||
*.pkg.*
|
|
2
Cargo.lock
generated
@ -28,7 +28,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "daisycalc"
|
name = "daisycalc"
|
||||||
version = "1.1.0"
|
version = "1.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"num",
|
"num",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "daisycalc"
|
name = "daisycalc"
|
||||||
version = "1.1.0"
|
version = "1.1.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
build = "buildscript/main.rs"
|
build = "buildscript/main.rs"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
@ -34,8 +34,7 @@ num = "0.4.1"
|
|||||||
#astro-float = "0.7.1"
|
#astro-float = "0.7.1"
|
||||||
|
|
||||||
[package.metadata.wasm-pack.profile.release]
|
[package.metadata.wasm-pack.profile.release]
|
||||||
# wasm-opt doesn't work, need to figure out why
|
wasm-opt = true
|
||||||
wasm-opt = false
|
|
||||||
|
|
||||||
[target.'cfg(target_family = "unix")'.dependencies]
|
[target.'cfg(target_family = "unix")'.dependencies]
|
||||||
termion = "2.0.1"
|
termion = "2.0.1"
|
||||||
|
18
Makefile
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
release:
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
test:
|
||||||
|
cargo test
|
||||||
|
|
||||||
|
run:
|
||||||
|
cargo run
|
||||||
|
|
||||||
|
wasm:
|
||||||
|
wasm-pack build --release --target web --out-dir server/pkg
|
||||||
|
|
||||||
|
publish:
|
||||||
|
cargo test
|
||||||
|
cargo publish
|
||||||
|
|
||||||
|
docker:
|
||||||
|
docker build ./server -t git.betalupi.com/mark/daisy
|
@ -1,9 +1,11 @@
|
|||||||

|

|
||||||
|
|
||||||
A high-precision scientific calculator with support for units, derivatives, and more.
|
A high-precision scientific calculator with support for units, derivatives, and more.
|
||||||
|
|
||||||
Many features are missing, this is still under development.
|
Many features are missing, this is still under development.
|
||||||
|
|
||||||
|
**Web demo: [here](https://daisy.betalupi.com) (won't work on mobile)**
|
||||||
|
|
||||||
# 📦 Installation
|
# 📦 Installation
|
||||||
- **Cargo:** `cargo install daisycalc`
|
- **Cargo:** `cargo install daisycalc`
|
||||||
- **Arch:** `yay -S daisy`
|
- **Arch:** `yay -S daisy`
|
||||||
|
18
TODO.md
@ -1,5 +1,4 @@
|
|||||||
## Version Bump checklist
|
## Version Bump checklist
|
||||||
- TODO: build and publish script
|
|
||||||
- update Cargo.toml
|
- update Cargo.toml
|
||||||
- run cargo test
|
- run cargo test
|
||||||
- commit
|
- commit
|
||||||
@ -7,8 +6,8 @@
|
|||||||
- merge
|
- merge
|
||||||
- git tag -a v1.0.0 -m "Version 1.0.0" on merge commit
|
- git tag -a v1.0.0 -m "Version 1.0.0" on merge commit
|
||||||
- cargo publish
|
- cargo publish
|
||||||
- Update packages
|
- Build wasm & push changes
|
||||||
|
- Update AUR package
|
||||||
|
|
||||||
## Pre-release
|
## Pre-release
|
||||||
- Tuple operations
|
- Tuple operations
|
||||||
@ -19,26 +18,18 @@
|
|||||||
- Should functions be operators?
|
- Should functions be operators?
|
||||||
- Binary, hex, octal numbers
|
- Binary, hex, octal numbers
|
||||||
|
|
||||||
|
|
||||||
## General
|
## General
|
||||||
- Better tests (assignment, many expressions in one context)
|
- Better tests (assignment, many expressions in one context)
|
||||||
- Optional config file
|
- Optional config file
|
||||||
- Optional history file
|
- Optional history file
|
||||||
- Compile to WASM, publish a webapp
|
|
||||||
- evaluate straight from command line
|
|
||||||
- Package for debian, nix
|
- Package for debian, nix
|
||||||
|
|
||||||
|
|
||||||
## Internals
|
|
||||||
- Non-recursive treeify
|
- Non-recursive treeify
|
||||||
- Faster factorial function. Maybe use gamma instead?
|
- Faster factorial function. Maybe use gamma instead?
|
||||||
- Arbitrary precision float (rug doesn't offer arbitrary exponents)
|
- Arbitrary precision floats
|
||||||
|
|
||||||
## Math Features
|
## Math Features
|
||||||
- Mean, Median, Min
|
- Mean, Median, Min
|
||||||
- Arbitrary base logarithm
|
- Arbitrary base logarithm
|
||||||
- Derivatives
|
|
||||||
- CAS features (trig, roots and powers)
|
|
||||||
- Complex numbers
|
- Complex numbers
|
||||||
- acot/acoth functions
|
- acot/acoth functions
|
||||||
- Sums and products with functional arguments
|
- Sums and products with functional arguments
|
||||||
@ -48,8 +39,7 @@
|
|||||||
- Fix terminal color detection
|
- Fix terminal color detection
|
||||||
- Live syntax/output (like firefox js terminal)
|
- Live syntax/output (like firefox js terminal)
|
||||||
- Syntax highlighting
|
- Syntax highlighting
|
||||||
- fish-style tab completion
|
- Numbered history recall
|
||||||
- Numbered expressions, history recall
|
|
||||||
- Enable/disable unit sets (defaults?)
|
- Enable/disable unit sets (defaults?)
|
||||||
- Consistent unit ordering
|
- Consistent unit ordering
|
||||||
|
|
||||||
|
2
server/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/site/node_modules
|
||||||
|
/pkg
|
14
server/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
FROM ubuntu AS node
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install cargo npm -y
|
||||||
|
COPY ./site ./site
|
||||||
|
RUN cd /site && npm install
|
||||||
|
|
||||||
|
FROM ubuntu
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install nginx -y
|
||||||
|
COPY --from=node /site /var/www/html
|
||||||
|
COPY ./pkg /var/www/html/pkg
|
||||||
|
COPY default /etc/nginx/sites-enabled/default
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["nginx", "-g", "daemon off;"]
|
31
server/default
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
types {
|
||||||
|
application/wasm wasm;
|
||||||
|
application/x-font-ttf ttc;
|
||||||
|
application/x-font-otf otf;
|
||||||
|
application/font-woff2 woff2;
|
||||||
|
font/ttf ttf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
# Add index.php to the list if you are using PHP
|
||||||
|
index index.html index.htm index.nginx-debian.html;
|
||||||
|
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to displaying a 404.
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* .(js|css|ttf|ttc|otf|eot|woff|woff2)$ {
|
||||||
|
add_header access-control-allow-origin "*";
|
||||||
|
expires max;
|
||||||
|
}
|
||||||
|
}
|
18
server/docker-compose.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
# You'll need to edit this file if you want to use it.
|
||||||
|
networks:
|
||||||
|
reverse_proxy:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
daisy:
|
||||||
|
build: .
|
||||||
|
container_name: daisy
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- reverse_proxy
|
||||||
|
|
||||||
|
#ports:
|
||||||
|
# - "80:80"
|
@ -1,13 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<title>Daisy Web</title>
|
||||||
|
<link rel="icon" href="resources/daisy-icon-light.svg" sizes="any" type="image/svg+xml">
|
||||||
|
<link rel="preload" href="resources/Fantasque.ttf" as="font" type="font/ttf" crossorigin>
|
||||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
|
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
|
||||||
<link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
|
<link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
|
||||||
<link rel="stylesheet" href="xterm.css">
|
|
||||||
<script src="node_modules/xterm/lib/xterm.js"></script>
|
<script src="node_modules/xterm/lib/xterm.js"></script>
|
||||||
<style>
|
<style>
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Fantasque;
|
font-family: Fantasque;
|
||||||
src: url("FantasqueSansMono/Regular/complete/Fantasque Sans Mono Regular Nerd Font Complete.ttf") format("opentype");
|
src: url("resources/Fantasque.ttf") format("opentype");
|
||||||
}
|
}
|
||||||
|
|
||||||
html, body {
|
html, body {
|
||||||
@ -18,7 +22,6 @@
|
|||||||
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
}
|
}
|
||||||
@ -53,7 +56,7 @@
|
|||||||
|
|
||||||
box-sizing: box;
|
box-sizing: box;
|
||||||
border: 0mm;
|
border: 0mm;
|
||||||
box-shadow: 0px 0px 10px 4px #4d5257;
|
box-shadow: 0px 0px 10px 4px #3c4044;
|
||||||
}
|
}
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
@ -82,7 +85,7 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<img id="banner" src = "misc/daisy-light.svg" alt="Daisy Banner"/>
|
<img id="banner" src = "resources/daisy-light.svg" alt="Daisy Banner"/>
|
||||||
<p>A high-precision, general-purpose scientific calculator</p>
|
<p>A high-precision, general-purpose scientific calculator</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -97,10 +100,14 @@
|
|||||||
<a href="https://aur.archlinux.org/packages/daisy" target="_blank" rel="noopener noreferrer">AUR</a>
|
<a href="https://aur.archlinux.org/packages/daisy" target="_blank" rel="noopener noreferrer">AUR</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
|
||||||
|
if (mobile) { alert("This site may not work on mobile."); }
|
||||||
|
</script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
// See wasm-pack docs
|
// See wasm-pack docs
|
||||||
// Build with `wasm-pack build --release --target web`
|
// Build with `wasm-pack build --release --target web --out-dir pkg`
|
||||||
// Works with wasm-pack 0.9.1. Some other versions give a segfault.
|
|
||||||
|
|
||||||
import init, { daisy_init, daisy_free, daisy_char, daisy_prompt } from './pkg/daisycalc.js';
|
import init, { daisy_init, daisy_free, daisy_char, daisy_prompt } from './pkg/daisycalc.js';
|
||||||
await init();
|
await init();
|
17
server/site/package-lock.json
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "site",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"xterm": "^5.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/xterm": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xterm/-/xterm-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5
server/site/package.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"xterm": "^5.3.0"
|
||||||
|
}
|
||||||
|
}
|
BIN
server/site/resources/Fantasque.ttf
Executable file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
133
server/site/resources/daisy-icon-dark.svg
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="391.21191"
|
||||||
|
height="383.02271"
|
||||||
|
viewBox="0 0 103.50814 101.34143"
|
||||||
|
version="1.1"
|
||||||
|
id="svg3246"
|
||||||
|
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
|
||||||
|
sodipodi:docname="daisy-icon-dark.svg"
|
||||||
|
xml:space="preserve"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||||
|
id="namedview3248"
|
||||||
|
pagecolor="#9e9e9e"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="true"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="true"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
showgrid="false"
|
||||||
|
showborder="true"
|
||||||
|
borderlayer="false"
|
||||||
|
shape-rendering="auto"
|
||||||
|
inkscape:zoom="0.19458888"
|
||||||
|
inkscape:cx="881.34533"
|
||||||
|
inkscape:cy="-418.83174"
|
||||||
|
inkscape:window-width="1280"
|
||||||
|
inkscape:window-height="1384"
|
||||||
|
inkscape:window-x="1280"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="layer1" /><defs
|
||||||
|
id="defs3243"><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-9-6" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-0" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-9" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-0-3" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-9" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-2" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-2-2" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-8" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-3" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-27" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-7" /></defs><g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-18.308946,-133.59209)"><g
|
||||||
|
id="g1657-2-9"
|
||||||
|
transform="matrix(4.4337012,0,0,4.4337012,-486.12826,763.96674)"
|
||||||
|
style="stroke:#a60d66;stroke-opacity:1"><g
|
||||||
|
id="g2349-6-0-3"
|
||||||
|
style="stroke:#ea004d;stroke-opacity:1"
|
||||||
|
transform="translate(102.69737,-168.67264)"><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 26.115101,47.660493 c 1.853776,0.96137 4.1474,0.53544 5.680504,-1.05487 1.410359,-1.46298 1.804214,-3.05883 1.179203,-4.77799 -0.966718,-2.6591 -3.720953,-3.9058 -8.552213,-3.87115 l -1.673694,0.012 0.11351,2.11848 c 0.142919,2.66699 0.428255,4.15648 1.018046,5.31437 0.567689,1.11447 1.136825,1.68985 2.234644,2.25917 z"
|
||||||
|
id="path302-3-1-7-2-9-7-6-6"
|
||||||
|
sodipodi:nodetypes="sssscsss" /><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 12.940109,34.959413 c -1.028597,-1.81733 -0.686937,-4.12501 0.846167,-5.71532 1.410353,-1.46298 2.990719,-1.915 4.731608,-1.35336 2.692707,0.86871 4.039427,3.57545 4.181707,8.40473 l 0.04931,1.67302 -2.121224,-0.0359 c -2.670426,-0.0452 -4.169372,-0.27577 -5.348089,-0.82278 -1.134496,-0.5265 -1.730333,-1.07418 -2.339471,-2.15042 z"
|
||||||
|
id="path302-3-1-2-0-0-8-5-8-0"
|
||||||
|
sodipodi:nodetypes="sssscsss" /></g><g
|
||||||
|
id="g1649-9-62"
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1"
|
||||||
|
transform="translate(-22.721851,-0.67464498)"><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 144.80192,-120.3375 c -1.85377,0.96136 -4.1474,0.53544 -5.6805,-1.05487 -1.41036,-1.46298 -1.80422,-3.05883 -1.1792,-4.77799 0.96671,-2.6591 3.72095,-3.9058 8.55221,-3.87116 l 1.67369,0.012 -0.11351,2.11849 c -0.14291,2.66698 -0.42825,4.15648 -1.01805,5.31437 -0.56768,1.11446 -1.13682,1.68985 -2.23464,2.25917 z"
|
||||||
|
id="path302-3-1-7-6-6-8-3-2-6"
|
||||||
|
sodipodi:nodetypes="sssscsss" /><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 157.9769,-133.03859 c 1.0286,-1.81733 0.68693,-4.12501 -0.84616,-5.71532 -1.41036,-1.46298 -2.99072,-1.915 -4.73161,-1.35336 -2.69271,0.86871 -4.03943,3.57545 -4.18171,8.40473 l -0.0493,1.67302 2.12122,-0.0359 c 2.67043,-0.0452 4.16938,-0.27577 5.34809,-0.82278 1.1345,-0.5265 1.73033,-1.07418 2.33947,-2.15042 z"
|
||||||
|
id="path302-3-1-2-0-2-8-0-5-6-1"
|
||||||
|
sodipodi:nodetypes="sssscsss" /></g></g></g></svg>
|
After Width: | Height: | Size: 5.7 KiB |
133
server/site/resources/daisy-icon-light.svg
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="391.21191"
|
||||||
|
height="383.02271"
|
||||||
|
viewBox="0 0 103.50814 101.34143"
|
||||||
|
version="1.1"
|
||||||
|
id="svg3246"
|
||||||
|
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
|
||||||
|
sodipodi:docname="daisy-icon-light.svg"
|
||||||
|
xml:space="preserve"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||||
|
id="namedview3248"
|
||||||
|
pagecolor="#9e9e9e"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="true"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="true"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
showgrid="false"
|
||||||
|
showborder="true"
|
||||||
|
borderlayer="false"
|
||||||
|
shape-rendering="auto"
|
||||||
|
inkscape:zoom="1.3137864"
|
||||||
|
inkscape:cx="280.48699"
|
||||||
|
inkscape:cy="34.632722"
|
||||||
|
inkscape:window-width="1280"
|
||||||
|
inkscape:window-height="1384"
|
||||||
|
inkscape:window-x="1280"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="g1649-9-62" /><defs
|
||||||
|
id="defs3243"><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-9-6" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-0" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-9" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-0-3" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-9" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-2" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-2-2" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-8" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-3" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-27" /><rect
|
||||||
|
x="567.45734"
|
||||||
|
y="347.68021"
|
||||||
|
width="408.88004"
|
||||||
|
height="160.23911"
|
||||||
|
id="rect2101-9-8-3-8-7" /></defs><g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-18.308946,-133.59209)"><g
|
||||||
|
id="g1657-2-9"
|
||||||
|
transform="matrix(4.4337012,0,0,4.4337012,-486.12826,763.96674)"
|
||||||
|
style="stroke:#a60d66;stroke-opacity:1"><g
|
||||||
|
id="g2349-6-0-3"
|
||||||
|
style="stroke:#ea004d;stroke-opacity:1"
|
||||||
|
transform="translate(102.69737,-168.67264)"><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 26.115101,47.660493 c 1.853776,0.96137 4.1474,0.53544 5.680504,-1.05487 1.410359,-1.46298 1.804214,-3.05883 1.179203,-4.77799 -0.966718,-2.6591 -3.720953,-3.9058 -8.552213,-3.87115 l -1.673694,0.012 0.11351,2.11848 c 0.142919,2.66699 0.428255,4.15648 1.018046,5.31437 0.567689,1.11447 1.136825,1.68985 2.234644,2.25917 z"
|
||||||
|
id="path302-3-1-7-2-9-7-6-6"
|
||||||
|
sodipodi:nodetypes="sssscsss" /><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 12.940109,34.959413 c -1.028597,-1.81733 -0.686937,-4.12501 0.846167,-5.71532 1.410353,-1.46298 2.990719,-1.915 4.731608,-1.35336 2.692707,0.86871 4.039427,3.57545 4.181707,8.40473 l 0.04931,1.67302 -2.121224,-0.0359 c -2.670426,-0.0452 -4.169372,-0.27577 -5.348089,-0.82278 -1.134496,-0.5265 -1.730333,-1.07418 -2.339471,-2.15042 z"
|
||||||
|
id="path302-3-1-2-0-0-8-5-8-0"
|
||||||
|
sodipodi:nodetypes="sssscsss" /></g><g
|
||||||
|
id="g1649-9-62"
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1"
|
||||||
|
transform="translate(-22.721851,-0.67464498)"><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 144.80192,-120.3375 c -1.85377,0.96136 -4.1474,0.53544 -5.6805,-1.05487 -1.41036,-1.46298 -1.80422,-3.05883 -1.1792,-4.77799 0.96671,-2.6591 3.72095,-3.9058 8.55221,-3.87116 l 1.67369,0.012 -0.11351,2.11849 c -0.14291,2.66698 -0.42825,4.15648 -1.01805,5.31437 -0.56768,1.11446 -1.13682,1.68985 -2.23464,2.25917 z"
|
||||||
|
id="path302-3-1-7-6-6-8-3-2-6"
|
||||||
|
sodipodi:nodetypes="sssscsss" /><path
|
||||||
|
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="m 157.9769,-133.03859 c 1.0286,-1.81733 0.68693,-4.12501 -0.84616,-5.71532 -1.41036,-1.46298 -2.99072,-1.915 -4.73161,-1.35336 -2.69271,0.86871 -4.03943,3.57545 -4.18171,8.40473 l -0.0493,1.67302 2.12122,-0.0359 c 2.67043,-0.0452 4.16938,-0.27577 5.34809,-0.82278 1.1345,-0.5265 1.73033,-1.07418 2.33947,-2.15042 z"
|
||||||
|
id="path302-3-1-2-0-2-8-0-5-6-1"
|
||||||
|
sodipodi:nodetypes="sssscsss" /></g></g></g></svg>
|
After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
15
shell.nix
@ -1,11 +1,22 @@
|
|||||||
|
{ nixpkgs ? import <nixpkgs> { }}:
|
||||||
let
|
let
|
||||||
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/f155f0cf4ea43c4e3c8918d2d327d44777b6cad4.tar.gz") {};
|
# If you set hash to an empty string, you'll get
|
||||||
|
# an error with the correct hash.
|
||||||
|
pinnedPkgs = nixpkgs.fetchFromGitHub {
|
||||||
|
owner = "NixOS";
|
||||||
|
repo = "nixpkgs";
|
||||||
|
rev = "4ecab3273592f27479a583fb6d975d4aba3486fe";
|
||||||
|
sha256 = "btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM=";
|
||||||
|
};
|
||||||
|
pkgs = import pinnedPkgs {};
|
||||||
|
|
||||||
in pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
cargo
|
cargo
|
||||||
rustc
|
rustc
|
||||||
rustfmt
|
rustfmt
|
||||||
m4
|
rust-analyzer
|
||||||
|
wasm-pack
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ pub fn is_command(
|
|||||||
| "vars"
|
| "vars"
|
||||||
| "consts" | "constants"
|
| "consts" | "constants"
|
||||||
| "del" | "delete"
|
| "del" | "delete"
|
||||||
|
| "flags"
|
||||||
=> true,
|
=> true,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
@ -66,6 +67,7 @@ pub fn do_command(
|
|||||||
"\n",
|
"\n",
|
||||||
"╞═══════════════ [t]Commands[n] ═══════════════╡\n",
|
"╞═══════════════ [t]Commands[n] ═══════════════╡\n",
|
||||||
" [c]help[n] Show this help\n",
|
" [c]help[n] Show this help\n",
|
||||||
|
" [c]flags[n] Show command-line options\n",
|
||||||
" [c]clear[n] Clear the terminal\n",
|
" [c]clear[n] Clear the terminal\n",
|
||||||
" [c]quit[n] Exit daisy\n",
|
" [c]quit[n] Exit daisy\n",
|
||||||
//" [c]units[n] List available units\n",
|
//" [c]units[n] List available units\n",
|
||||||
@ -81,6 +83,27 @@ pub fn do_command(
|
|||||||
return t;
|
return t;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"flags" => {
|
||||||
|
return FormattedText::new(
|
||||||
|
concat!(
|
||||||
|
"\n",
|
||||||
|
"A list of command-line arguments is below\n",
|
||||||
|
"\n",
|
||||||
|
"╞════ [t]Flag[n] ════╪════════════════ [t]Function[n] ════════════════╡\n",
|
||||||
|
" [c]--help[n] Show help\n",
|
||||||
|
" [c]--version[n] Show version\n",
|
||||||
|
" [c]--info[n] Show system information\n",
|
||||||
|
" [c]--256color[n] Use full color support (default)\n",
|
||||||
|
" [c]--8color[n] Use reduced colors (ANSI, no styling)\n",
|
||||||
|
" [c]--nocolor[n] Do not use colors and styling\n",
|
||||||
|
" [c]--nosub[n] Disable inline substitution\n",
|
||||||
|
" [c]--nosuper[n] Disable superscript powers\n",
|
||||||
|
" [c]--nooneover[n] Disable \"one-over\" fractions as -1 power\n",
|
||||||
|
"\n\n"
|
||||||
|
).to_string()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
"clear" => {
|
"clear" => {
|
||||||
return FormattedText::new("[clear]".to_string());
|
return FormattedText::new("[clear]".to_string());
|
||||||
},
|
},
|
||||||
|
28
src/lib.rs
@ -68,15 +68,12 @@ cfg_if::cfg_if! {
|
|||||||
return format!("\r\n{}", daisy_prompt(state));
|
return format!("\r\n{}", daisy_prompt(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
if in_str.trim() == "quit" {
|
|
||||||
return "[quit]".to_string();
|
|
||||||
} else {
|
|
||||||
let r = crate::do_string( unsafe { &mut (*state).context }, &in_str);
|
|
||||||
|
|
||||||
match r {
|
let r = crate::do_string( unsafe { &mut (*state).context }, &in_str);
|
||||||
Ok(t) | Err(t) => {
|
|
||||||
out += t;
|
match r {
|
||||||
}
|
Ok(t) | Err(t) => {
|
||||||
|
out += t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -91,7 +88,20 @@ cfg_if::cfg_if! {
|
|||||||
//'\x04' | '\x03'
|
//'\x04' | '\x03'
|
||||||
//=> { break 'outer; },
|
//=> { break 'outer; },
|
||||||
|
|
||||||
_ => { unsafe { (*state).promptbuffer.add_char(s.chars().next().unwrap()); } },
|
// Only process sane characters
|
||||||
|
|
||||||
|
_ => {
|
||||||
|
let c = s.chars().next().unwrap();
|
||||||
|
match c {
|
||||||
|
'a'..='z' | 'A'..='Z' | '0'..='9'
|
||||||
|
|'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')'
|
||||||
|
|'?'|'~'|','|'.'|'['|']'|' '
|
||||||
|
|'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';'
|
||||||
|
=> { unsafe { (*state).promptbuffer.add_char(c); } },
|
||||||
|
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let t = unsafe { (*state).promptbuffer.write_prompt(&mut (*state).context) };
|
let t = unsafe { (*state).promptbuffer.write_prompt(&mut (*state).context) };
|
||||||
|
39
src/main.rs
@ -26,7 +26,9 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||||||
let mut pb: PromptBuffer = PromptBuffer::new(64);
|
let mut pb: PromptBuffer = PromptBuffer::new(64);
|
||||||
let mut context = Context::new();
|
let mut context = Context::new();
|
||||||
|
|
||||||
// Set color compatibilty
|
// Detect color compatibilty
|
||||||
|
// Currently unused, this is slow.
|
||||||
|
/*
|
||||||
let term_colors = stdout.available_colors().unwrap_or(0);
|
let term_colors = stdout.available_colors().unwrap_or(0);
|
||||||
if term_colors >= 256 {
|
if term_colors >= 256 {
|
||||||
context.config.term_color_type = 2;
|
context.config.term_color_type = 2;
|
||||||
@ -35,9 +37,7 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||||||
} else {
|
} else {
|
||||||
context.config.term_color_type = 0;
|
context.config.term_color_type = 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
context.config.check();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Handle command-line arguments
|
// Handle command-line arguments
|
||||||
@ -45,6 +45,8 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||||||
if args.iter().any(|s| s == "--help") {
|
if args.iter().any(|s| s == "--help") {
|
||||||
let t = command::do_command(&mut context, &String::from("help"));
|
let t = command::do_command(&mut context, &String::from("help"));
|
||||||
t.write(&context, &mut stdout)?;
|
t.write(&context, &mut stdout)?;
|
||||||
|
let t = command::do_command(&mut context, &String::from("flags"));
|
||||||
|
t.write(&context, &mut stdout)?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else if args.iter().any(|s| s == "--version") {
|
} else if args.iter().any(|s| s == "--version") {
|
||||||
let t = FormattedText::new(format!(
|
let t = FormattedText::new(format!(
|
||||||
@ -52,19 +54,34 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||||||
));
|
));
|
||||||
t.write(&context, &mut stdout)?;
|
t.write(&context, &mut stdout)?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else if args.iter().any(|s| s == "--debug") {
|
} else if args.iter().any(|s| s == "--info") {
|
||||||
let t = FormattedText::new(format!(
|
let t = FormattedText::new(format!(
|
||||||
concat!(
|
concat!(
|
||||||
"Daisy v{}\n",
|
"Daisy v{}\n",
|
||||||
"Your terminal supports {} colors.\n"
|
"Your terminal supports {} colors.\n"
|
||||||
),
|
),
|
||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
term_colors
|
stdout.available_colors().unwrap_or(0)
|
||||||
));
|
));
|
||||||
t.write(&context, &mut stdout)?;
|
t.write(&context, &mut stdout)?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
} else if args.iter().any(|s| s == "--256color") {
|
||||||
|
context.config.term_color_type = 2;
|
||||||
|
} else if args.iter().any(|s| s == "--8color") {
|
||||||
|
context.config.term_color_type = 1;
|
||||||
|
} else if args.iter().any(|s| s == "--0color") {
|
||||||
|
context.config.term_color_type = 0;
|
||||||
|
} else if args.iter().any(|s| s == "--nosub") {
|
||||||
|
context.config.enable_substituion = false;
|
||||||
|
} else if args.iter().any(|s| s == "--nosuper") {
|
||||||
|
context.config.enable_super_powers = false;
|
||||||
|
} else if args.iter().any(|s| s == "--nooneover") {
|
||||||
|
context.config.enable_one_over_power = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.config.check();
|
||||||
|
|
||||||
|
|
||||||
'outer: loop {
|
'outer: loop {
|
||||||
|
|
||||||
let t = pb.write_prompt(&mut context);
|
let t = pb.write_prompt(&mut context);
|
||||||
@ -99,7 +116,15 @@ pub fn main() -> Result<(), std::io::Error> {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
_ => { pb.add_char(*q); }
|
|
||||||
|
// Only process sane characters
|
||||||
|
'a'..='z' | 'A'..='Z' | '0'..='9'
|
||||||
|
|'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')'
|
||||||
|
|'?'|'~'|','|'.'|'['|']'|' '
|
||||||
|
|'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';'
|
||||||
|
=> { pb.add_char(*q); },
|
||||||
|
|
||||||
|
_ => {}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
match c.unwrap() {
|
match c.unwrap() {
|
||||||
|