Merge pull request #8 from rm-dr/dev

Merge v1.1.3
pull/9/head^2
Mark 2023-09-22 10:48:59 -07:00 committed by GitHub
commit 63d4a01095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 81 additions and 33 deletions

2
Cargo.lock generated
View File

@ -28,7 +28,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "daisycalc" name = "daisycalc"
version = "1.1.2" version = "1.1.3"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"num", "num",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "daisycalc" name = "daisycalc"
version = "1.1.2" 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"

18
Makefile Normal file
View 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

View File

@ -1,4 +1,4 @@
![](./site/misc/readme-banner.png) ![](./server/site/resources/readme-banner.png)
A high-precision scientific calculator with support for units, derivatives, and more. A high-precision scientific calculator with support for units, derivatives, and more.

16
TODO.md
View File

@ -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,12 +6,9 @@
- 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 - Build wasm & push changes
- Squash merge
- Update AUR package - Update AUR package
## Pre-release ## Pre-release
- Tuple operations - Tuple operations
- we don't need vectors as arguments to operators - we don't need vectors as arguments to operators
@ -22,25 +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
- 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
@ -50,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
View File

@ -0,0 +1,2 @@
/site/node_modules
/pkg

View File

@ -7,7 +7,7 @@ networks:
services: services:
daisy: daisy:
build: ./. build: .
container_name: daisy container_name: daisy
restart: unless-stopped restart: unless-stopped

View File

@ -100,6 +100,11 @@
<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 --out-dir pkg` // Build with `wasm-pack build --release --target web --out-dir pkg`

17
server/site/package-lock.json generated Normal file
View 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=="
}
}
}

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -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
]; ];
} }

3
site/.gitignore vendored
View File

@ -1,3 +0,0 @@
/node_modules
/package-lock.json
/pkg

View File

@ -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) };

View File

@ -120,7 +120,7 @@ pub fn main() -> Result<(), std::io::Error> {
// Only process sane characters // Only process sane characters
'a'..='z' | 'A'..='Z' | '0'..='9' 'a'..='z' | 'A'..='Z' | '0'..='9'
|'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')' |'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')'
|'?'|'~'|','|'.'|'['|']' |'?'|'~'|','|'.'|'['|']'|' '
|'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';' |'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';'
=> { pb.add_char(*q); }, => { pb.add_char(*q); },