Compare commits
	
		
			90 Commits
		
	
	
		
			v1.0.1
			...
			a75f6197cd
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a75f6197cd | |||
| 
						
						
							
						
						2f2c005c86
	
				 | 
					
					
						|||
| 
						
						
							
						
						ffebcf2e15
	
				 | 
					
					
						|||
| 4e1df2399b | |||
| 
						 | 
					5a921cfc7b | ||
| 
						
						
							
						
						2531524ffd
	
				 | 
					
					
						|||
| 
						
						
							
						
						e5525adcca
	
				 | 
					
					
						|||
| 
						
						
							
						
						a61cbf29e5
	
				 | 
					
					
						|||
| 39ab47530e | |||
| 
						
						
							
						
						be28669416
	
				 | 
					
					
						|||
| 
						
						
							
						
						7658ff76ef
	
				 | 
					
					
						|||
| 
						
						
							
						
						e9d392b80b
	
				 | 
					
					
						|||
| 63d4a01095 | |||
| 
						
						
							
						
						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
	
				 | 
					
					
						|||
| 
						
						
							
						
						69ba2ab715
	
				 | 
					
					
						|||
| 
						
						
							
						
						f9382616b2
	
				 | 
					
					
						|||
| 
						
						
							
						
						921bd4d704
	
				 | 
					
					
						|||
| 
						
						
							
						
						cb9f69948c
	
				 | 
					
					
						|||
| 
						
						
							
						
						7d78d0d74d
	
				 | 
					
					
						|||
| 
						
						
							
						
						0c07cb258b
	
				 | 
					
					
						|||
| 
						
						
							
						
						4aba24ec69
	
				 | 
					
					
						|||
| 
						
						
							
						
						c8ebec59ae
	
				 | 
					
					
						|||
| 
						
						
							
						
						1bd0b2580b
	
				 | 
					
					
						|||
| 
						
						
							
						
						dbde7cb6f4
	
				 | 
					
					
						|||
| 
						
						
							
						
						470c3a49ed
	
				 | 
					
					
						|||
| 
						
						
							
						
						c237e9d5ec
	
				 | 
					
					
						|||
| 
						
						
							
						
						fde1220a96
	
				 | 
					
					
						|||
| 
						
						
							
						
						2f1f8a0801
	
				 | 
					
					
						|||
| bab305e11d | |||
| 
						
						
							
						
						d906c474c5
	
				 | 
					
					
						|||
| 
						
						
							
						
						315be575ee
	
				 | 
					
					
						|||
| 
						
						
							
						
						31c368f7d8
	
				 | 
					
					
						|||
| 
						
						
							
						
						8a026fc2ea
	
				 | 
					
					
						|||
| 
						
						
							
						
						8497c125ef
	
				 | 
					
					
						|||
| 
						
						
							
						
						682205f5e1
	
				 | 
					
					
						|||
| 
						
						
							
						
						e1ba2a9c1f
	
				 | 
					
					
						|||
| 
						
						
							
						
						b9cfe719a6
	
				 | 
					
					
						|||
| 47abd9d18e | |||
| 4353548900 | |||
| 84ebf89d6f | |||
| 2391606ae1 | |||
| 38c982bb00 | |||
| 80b1c76c59 | |||
| 11b5cd877a | |||
| 
						
						
							
						
						3a08cfb2d3
	
				 | 
					
					
						|||
| 
						
						
							
						
						b136353d36
	
				 | 
					
					
						|||
| 
						
						
							
						
						a125e867c4
	
				 | 
					
					
						|||
| 
						
						
							
						
						c477302c88
	
				 | 
					
					
						|||
| 
						
						
							
						
						edc859dc01
	
				 | 
					
					
						|||
| 
						
						
							
						
						77c357c2f3
	
				 | 
					
					
						|||
| 
						
						
							
						
						3ae5383eed
	
				 | 
					
					
						|||
| 
						
						
							
						
						4055c08217
	
				 | 
					
					
						|||
| 
						
						
							
						
						6969d17cce
	
				 | 
					
					
						|||
| 
						
						
							
						
						6e3609d85e
	
				 | 
					
					
						|||
| 
						
						
							
						
						f9ec4d82fe
	
				 | 
					
					
						|||
| 
						
						
							
						
						86b5356d4f
	
				 | 
					
					
						|||
| 
						
						
							
						
						cc81c3979c
	
				 | 
					
					
						|||
| 
						
						
							
						
						b846a7c144
	
				 | 
					
					
						|||
| 
						
						
							
						
						09996801d8
	
				 | 
					
					
						
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -1,4 +1,3 @@
 | 
				
			|||||||
/target
 | 
					/target
 | 
				
			||||||
/src/target
 | 
					/src/target
 | 
				
			||||||
/pkg
 | 
					/pkg
 | 
				
			||||||
*.pkg.*
 | 
					 | 
				
			||||||
							
								
								
									
										242
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						@@ -8,18 +8,18 @@ version = "1.1.0"
 | 
				
			|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
 | 
					checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "az"
 | 
					 | 
				
			||||||
version = "1.2.1"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "bitflags"
 | 
					name = "bitflags"
 | 
				
			||||||
version = "1.3.2"
 | 
					version = "1.3.2"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 | 
					checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "bumpalo"
 | 
				
			||||||
 | 
					version = "3.14.0"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "cfg-if"
 | 
					name = "cfg-if"
 | 
				
			||||||
version = "1.0.0"
 | 
					version = "1.0.0"
 | 
				
			||||||
@@ -28,22 +28,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "daisycalc"
 | 
					name = "daisycalc"
 | 
				
			||||||
version = "1.0.1"
 | 
					version = "1.1.5"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "cfg-if",
 | 
					 "cfg-if",
 | 
				
			||||||
 "rug",
 | 
					 "num",
 | 
				
			||||||
 "termion",
 | 
					 "termion",
 | 
				
			||||||
 "toml",
 | 
					 "toml",
 | 
				
			||||||
]
 | 
					 "wasm-bindgen",
 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "gmp-mpfr-sys"
 | 
					 | 
				
			||||||
version = "1.5.2"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "5b560063e2ffa8ce9c2ef9bf487f2944a97deca5b8de0b5bcd0ae6437ef8b75f"
 | 
					 | 
				
			||||||
dependencies = [
 | 
					 | 
				
			||||||
 "libc",
 | 
					 | 
				
			||||||
 "windows-sys",
 | 
					 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
@@ -64,9 +55,15 @@ dependencies = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "libc"
 | 
					name = "libc"
 | 
				
			||||||
version = "0.2.140"
 | 
					version = "0.2.147"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
 | 
					checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "log"
 | 
				
			||||||
 | 
					version = "0.4.20"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "memchr"
 | 
					name = "memchr"
 | 
				
			||||||
@@ -74,12 +71,112 @@ version = "2.5.0"
 | 
				
			|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
 | 
					checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "num"
 | 
				
			||||||
 | 
					version = "0.4.1"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "num-bigint",
 | 
				
			||||||
 | 
					 "num-complex",
 | 
				
			||||||
 | 
					 "num-integer",
 | 
				
			||||||
 | 
					 "num-iter",
 | 
				
			||||||
 | 
					 "num-rational",
 | 
				
			||||||
 | 
					 "num-traits",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "num-bigint"
 | 
				
			||||||
 | 
					version = "0.4.4"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "autocfg",
 | 
				
			||||||
 | 
					 "num-integer",
 | 
				
			||||||
 | 
					 "num-traits",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "num-complex"
 | 
				
			||||||
 | 
					version = "0.4.4"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "num-traits",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "num-integer"
 | 
				
			||||||
 | 
					version = "0.1.45"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "autocfg",
 | 
				
			||||||
 | 
					 "num-traits",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "num-iter"
 | 
				
			||||||
 | 
					version = "0.1.43"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "autocfg",
 | 
				
			||||||
 | 
					 "num-integer",
 | 
				
			||||||
 | 
					 "num-traits",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "num-rational"
 | 
				
			||||||
 | 
					version = "0.4.1"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "autocfg",
 | 
				
			||||||
 | 
					 "num-bigint",
 | 
				
			||||||
 | 
					 "num-integer",
 | 
				
			||||||
 | 
					 "num-traits",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "num-traits"
 | 
				
			||||||
 | 
					version = "0.2.16"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "autocfg",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "numtoa"
 | 
					name = "numtoa"
 | 
				
			||||||
version = "0.1.0"
 | 
					version = "0.1.0"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
 | 
					checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "once_cell"
 | 
				
			||||||
 | 
					version = "1.18.0"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "proc-macro2"
 | 
				
			||||||
 | 
					version = "1.0.67"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "unicode-ident",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "quote"
 | 
				
			||||||
 | 
					version = "1.0.33"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "proc-macro2",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "redox_syscall"
 | 
					name = "redox_syscall"
 | 
				
			||||||
version = "0.2.16"
 | 
					version = "0.2.16"
 | 
				
			||||||
@@ -98,17 +195,6 @@ dependencies = [
 | 
				
			|||||||
 "redox_syscall",
 | 
					 "redox_syscall",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "rug"
 | 
					 | 
				
			||||||
version = "1.19.2"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "555e8b44763d034526db899c88cd56ccc4486cd38b444c8aa0e79d4e70ae5a34"
 | 
					 | 
				
			||||||
dependencies = [
 | 
					 | 
				
			||||||
 "az",
 | 
					 | 
				
			||||||
 "gmp-mpfr-sys",
 | 
					 | 
				
			||||||
 "libc",
 | 
					 | 
				
			||||||
]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "serde"
 | 
					name = "serde"
 | 
				
			||||||
version = "1.0.164"
 | 
					version = "1.0.164"
 | 
				
			||||||
@@ -124,6 +210,17 @@ dependencies = [
 | 
				
			|||||||
 "serde",
 | 
					 "serde",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "syn"
 | 
				
			||||||
 | 
					version = "2.0.37"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "7303ef2c05cd654186cb250d29049a24840ca25d2747c25c0381c8d9e2f582e8"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "proc-macro2",
 | 
				
			||||||
 | 
					 "quote",
 | 
				
			||||||
 | 
					 "unicode-ident",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "termion"
 | 
					name = "termion"
 | 
				
			||||||
version = "2.0.1"
 | 
					version = "2.0.1"
 | 
				
			||||||
@@ -171,61 +268,64 @@ dependencies = [
 | 
				
			|||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "windows-sys"
 | 
					name = "unicode-ident"
 | 
				
			||||||
version = "0.42.0"
 | 
					version = "1.0.12"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
 | 
					checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "wasm-bindgen"
 | 
				
			||||||
 | 
					version = "0.2.87"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "windows_aarch64_gnullvm",
 | 
					 "cfg-if",
 | 
				
			||||||
 "windows_aarch64_msvc",
 | 
					 "wasm-bindgen-macro",
 | 
				
			||||||
 "windows_i686_gnu",
 | 
					 | 
				
			||||||
 "windows_i686_msvc",
 | 
					 | 
				
			||||||
 "windows_x86_64_gnu",
 | 
					 | 
				
			||||||
 "windows_x86_64_gnullvm",
 | 
					 | 
				
			||||||
 "windows_x86_64_msvc",
 | 
					 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "windows_aarch64_gnullvm"
 | 
					name = "wasm-bindgen-backend"
 | 
				
			||||||
version = "0.42.2"
 | 
					version = "0.2.87"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
 | 
					checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "bumpalo",
 | 
				
			||||||
 | 
					 "log",
 | 
				
			||||||
 | 
					 "once_cell",
 | 
				
			||||||
 | 
					 "proc-macro2",
 | 
				
			||||||
 | 
					 "quote",
 | 
				
			||||||
 | 
					 "syn",
 | 
				
			||||||
 | 
					 "wasm-bindgen-shared",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "windows_aarch64_msvc"
 | 
					name = "wasm-bindgen-macro"
 | 
				
			||||||
version = "0.42.2"
 | 
					version = "0.2.87"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
 | 
					checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "quote",
 | 
				
			||||||
 | 
					 "wasm-bindgen-macro-support",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "windows_i686_gnu"
 | 
					name = "wasm-bindgen-macro-support"
 | 
				
			||||||
version = "0.42.2"
 | 
					version = "0.2.87"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
 | 
					checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "proc-macro2",
 | 
				
			||||||
 | 
					 "quote",
 | 
				
			||||||
 | 
					 "syn",
 | 
				
			||||||
 | 
					 "wasm-bindgen-backend",
 | 
				
			||||||
 | 
					 "wasm-bindgen-shared",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "windows_i686_msvc"
 | 
					name = "wasm-bindgen-shared"
 | 
				
			||||||
version = "0.42.2"
 | 
					version = "0.2.87"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
 | 
					checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "windows_x86_64_gnu"
 | 
					 | 
				
			||||||
version = "0.42.2"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "windows_x86_64_gnullvm"
 | 
					 | 
				
			||||||
version = "0.42.2"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "windows_x86_64_msvc"
 | 
					 | 
				
			||||||
version = "0.42.2"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "winnow"
 | 
					name = "winnow"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								Cargo.toml
									
									
									
									
									
								
							
							
						
						@@ -1,6 +1,6 @@
 | 
				
			|||||||
[package]
 | 
					[package]
 | 
				
			||||||
name = "daisycalc"
 | 
					name = "daisycalc"
 | 
				
			||||||
version = "1.0.1"
 | 
					version = "1.1.5"
 | 
				
			||||||
edition = "2021"
 | 
					edition = "2021"
 | 
				
			||||||
build = "buildscript/main.rs"
 | 
					build = "buildscript/main.rs"
 | 
				
			||||||
license = "GPL-3.0-only"
 | 
					license = "GPL-3.0-only"
 | 
				
			||||||
@@ -13,6 +13,11 @@ readme = "README.md"
 | 
				
			|||||||
name = "daisy"
 | 
					name = "daisy"
 | 
				
			||||||
path = "src/main.rs"
 | 
					path = "src/main.rs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[lib]
 | 
				
			||||||
 | 
					name = "daisycalc"
 | 
				
			||||||
 | 
					path = "src/lib.rs"
 | 
				
			||||||
 | 
					crate-type = ["cdylib", "rlib"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[profile.release]
 | 
					[profile.release]
 | 
				
			||||||
opt-level = 3
 | 
					opt-level = 3
 | 
				
			||||||
debug = 0
 | 
					debug = 0
 | 
				
			||||||
@@ -25,10 +30,18 @@ panic = "abort"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
cfg-if = "1.0.0"
 | 
					cfg-if = "1.0.0"
 | 
				
			||||||
 | 
					num = "0.4.1"
 | 
				
			||||||
 | 
					#astro-float = "0.7.1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[package.metadata.wasm-pack.profile.release]
 | 
				
			||||||
 | 
					wasm-opt = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[target.'cfg(target_family = "unix")'.dependencies]
 | 
					[target.'cfg(target_family = "unix")'.dependencies]
 | 
				
			||||||
termion = "2.0.1"
 | 
					termion = "2.0.1"
 | 
				
			||||||
rug = "1.19.2"
 | 
					
 | 
				
			||||||
 | 
					[target.'cfg(target_arch = "wasm32")'.dependencies]
 | 
				
			||||||
 | 
					wasm-bindgen = "0.2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[build-dependencies]
 | 
					[build-dependencies]
 | 
				
			||||||
toml = "0.7.4"
 | 
					toml = "0.7.4"
 | 
				
			||||||
							
								
								
									
										19
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					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: wasm
 | 
				
			||||||
 | 
						docker build ./server -t git.betalupi.com/mark/daisy --no-cache
 | 
				
			||||||
 | 
						docker push 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`
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										46
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						@@ -2,67 +2,45 @@
 | 
				
			|||||||
 - update Cargo.toml
 | 
					 - update Cargo.toml
 | 
				
			||||||
 - run cargo test
 | 
					 - run cargo test
 | 
				
			||||||
 - commit
 | 
					 - commit
 | 
				
			||||||
 - git tag -a v1.0.0 -m "Version 1.0.0"
 | 
					 - push
 | 
				
			||||||
 - git push
 | 
					 - merge
 | 
				
			||||||
 - git push origin v1.0.0
 | 
					 - 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
 | 
				
			||||||
 - Fix linelocation (consistent, what does an operator's linelocation mean?)
 | 
					 | 
				
			||||||
 - Tuple operations
 | 
					 - Tuple operations
 | 
				
			||||||
 - we don't need vectors as arguments to operators
 | 
					 - we don't need vectors as arguments to operators
 | 
				
			||||||
 - Assignment tests
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Parser
 | 
					## Parser
 | 
				
			||||||
 - Better error when `sin = 2`
 | 
					 | 
				
			||||||
 - 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)
 | 
				
			||||||
 - Optional config file
 | 
					 - Optional config file
 | 
				
			||||||
 - Optional history file
 | 
					 - Optional history file
 | 
				
			||||||
 - daisyrc file
 | 
					 - Package for debian, nix
 | 
				
			||||||
 - Compile to WASM, publish a webapp
 | 
					 | 
				
			||||||
 - evaluate straight from command line
 | 
					 | 
				
			||||||
 - Auto-push to crates.io
 | 
					 | 
				
			||||||
 - Package for debian
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## 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
 | 
				
			||||||
 - Remove rug dependency (too big, incompatible)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Math Features
 | 
					## Math Features
 | 
				
			||||||
 - Dice
 | 
					 | 
				
			||||||
 - 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
 | 
				
			||||||
 | 
					 - Add functions: gcd, inverse mod, dice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Prompt
 | 
					## Prompt
 | 
				
			||||||
 | 
					 - Fix terminal color detection
 | 
				
			||||||
 - Live syntax/output (like firefox js terminal)
 | 
					 - Live syntax/output (like firefox js terminal)
 | 
				
			||||||
 - Syntax highlight input and output
 | 
					 - Syntax highlighting
 | 
				
			||||||
 - fish-style tab completion
 | 
					 - Numbered history recall
 | 
				
			||||||
 - Numbered expressions, history recall
 | 
					 | 
				
			||||||
 - Color configuration
 | 
					 | 
				
			||||||
 - Enable/disable unit sets (defaults?)
 | 
					 - Enable/disable unit sets (defaults?)
 | 
				
			||||||
 - Consistent unit ordering
 | 
					 - Consistent unit ordering
 | 
				
			||||||
 - Better linelocation
 | 
					 | 
				
			||||||
   - we shouldn't need to re-print user input on evaluation errors, red arrows should adjust themselves to the prettyprinted string
 | 
					 | 
				
			||||||
 - Backend-independent colorful printing
 | 
					 | 
				
			||||||
   - Better colors in error texts
 | 
					 | 
				
			||||||
 - Better substitution. Consistent: when ascii, when unicode?
 | 
					 | 
				
			||||||
 - Command to list substitutions
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Units
 | 
					## Units
 | 
				
			||||||
 - long prefixes (megatonne, etc)
 | 
					 - long prefixes (megatonne, etc)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,7 +49,7 @@ value = "1.602176634e-19 C"
 | 
				
			|||||||
enum_name = "ElectronMass"
 | 
					enum_name = "ElectronMass"
 | 
				
			||||||
pretty_name = "Electron mass"
 | 
					pretty_name = "Electron mass"
 | 
				
			||||||
strings = ["electronmass"]
 | 
					strings = ["electronmass"]
 | 
				
			||||||
value = "9.1093837015-31 kg"
 | 
					value = "9.1093837015e-31 kg"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[constant]]
 | 
					[[constant]]
 | 
				
			||||||
enum_name = "ProtonMass"
 | 
					enum_name = "ProtonMass"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										240
									
								
								misc/daisy.svg
									
									
									
									
									
								
							
							
						
						@@ -1,240 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
					 | 
				
			||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<svg
 | 
					 | 
				
			||||||
   width="1200"
 | 
					 | 
				
			||||||
   height="850"
 | 
					 | 
				
			||||||
   viewBox="0 0 317.49998 224.89584"
 | 
					 | 
				
			||||||
   version="1.1"
 | 
					 | 
				
			||||||
   id="svg3246"
 | 
					 | 
				
			||||||
   inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
 | 
					 | 
				
			||||||
   sodipodi:docname="daisy.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.39300486"
 | 
					 | 
				
			||||||
     inkscape:cx="1349.8561"
 | 
					 | 
				
			||||||
     inkscape:cy="-150.12537"
 | 
					 | 
				
			||||||
     inkscape:window-width="2560"
 | 
					 | 
				
			||||||
     inkscape:window-height="1384"
 | 
					 | 
				
			||||||
     inkscape:window-x="0"
 | 
					 | 
				
			||||||
     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"><rect
 | 
					 | 
				
			||||||
       style="fill:#0d1117;fill-opacity:1;stroke:none;stroke-width:5.40518;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1"
 | 
					 | 
				
			||||||
       id="rect1146-6"
 | 
					 | 
				
			||||||
       width="317.5"
 | 
					 | 
				
			||||||
       height="105.83333"
 | 
					 | 
				
			||||||
       x="0"
 | 
					 | 
				
			||||||
       y="0" /><rect
 | 
					 | 
				
			||||||
       style="fill:#415472;fill-opacity:0.78596705;stroke:none;stroke-width:9.36205;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1"
 | 
					 | 
				
			||||||
       id="rect1146-6-4"
 | 
					 | 
				
			||||||
       width="952.5"
 | 
					 | 
				
			||||||
       height="105.83333"
 | 
					 | 
				
			||||||
       x="-93.034294"
 | 
					 | 
				
			||||||
       y="-223.72656"
 | 
					 | 
				
			||||||
       inkscape:export-filename="rect1146-6-4.png"
 | 
					 | 
				
			||||||
       inkscape:export-xdpi="96"
 | 
					 | 
				
			||||||
       inkscape:export-ydpi="96" /><g
 | 
					 | 
				
			||||||
       id="g6067"
 | 
					 | 
				
			||||||
       inkscape:export-filename="g6067.png"
 | 
					 | 
				
			||||||
       inkscape:export-xdpi="96"
 | 
					 | 
				
			||||||
       inkscape:export-ydpi="96"
 | 
					 | 
				
			||||||
       transform="translate(-11.12614,-1.0494528)"><g
 | 
					 | 
				
			||||||
         id="g1657-2"
 | 
					 | 
				
			||||||
         transform="matrix(3.2163178,0,0,3.2163178,-409.57698,470.69872)"
 | 
					 | 
				
			||||||
         style="stroke:#a60d66;stroke-opacity:1"><g
 | 
					 | 
				
			||||||
           id="g2349-6-0"
 | 
					 | 
				
			||||||
           style="stroke:#ea004d;stroke-opacity:1"
 | 
					 | 
				
			||||||
           transform="translate(125.41922,-167.998)"><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"
 | 
					 | 
				
			||||||
             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"
 | 
					 | 
				
			||||||
             sodipodi:nodetypes="sssscsss" /></g><g
 | 
					 | 
				
			||||||
           id="g1649-9"
 | 
					 | 
				
			||||||
           style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1"><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"
 | 
					 | 
				
			||||||
             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"
 | 
					 | 
				
			||||||
             sodipodi:nodetypes="sssscsss" /></g></g><text
 | 
					 | 
				
			||||||
         xml:space="preserve"
 | 
					 | 
				
			||||||
         transform="matrix(1.2936576,0,0,1.2936576,-614.37024,-444.76722)"
 | 
					 | 
				
			||||||
         id="text2099-9-3-6-4"
 | 
					 | 
				
			||||||
         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;white-space:pre;shape-inside:url(#rect2101-9-8-3-8);display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:15.1181;stroke-linecap:round;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"><tspan
 | 
					 | 
				
			||||||
           x="567.45703"
 | 
					 | 
				
			||||||
           y="402.89793"
 | 
					 | 
				
			||||||
           id="tspan3867">Daisy</tspan></text></g><g
 | 
					 | 
				
			||||||
       id="g6067-9"
 | 
					 | 
				
			||||||
       inkscape:export-filename="g6067.png"
 | 
					 | 
				
			||||||
       inkscape:export-xdpi="96"
 | 
					 | 
				
			||||||
       inkscape:export-ydpi="96"
 | 
					 | 
				
			||||||
       transform="translate(213.33957,-224.77602)"><g
 | 
					 | 
				
			||||||
         id="g1657-2-2"
 | 
					 | 
				
			||||||
         transform="matrix(3.2163178,0,0,3.2163178,-409.57698,470.69872)"
 | 
					 | 
				
			||||||
         style="stroke:#a60d66;stroke-opacity:1"><g
 | 
					 | 
				
			||||||
           id="g2349-6-0-0"
 | 
					 | 
				
			||||||
           style="stroke:#ea004d;stroke-opacity:1"
 | 
					 | 
				
			||||||
           transform="translate(125.41922,-167.998)"><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-2"
 | 
					 | 
				
			||||||
             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-3"
 | 
					 | 
				
			||||||
             sodipodi:nodetypes="sssscsss" /></g><g
 | 
					 | 
				
			||||||
           id="g1649-9-7"
 | 
					 | 
				
			||||||
           style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1"><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-5"
 | 
					 | 
				
			||||||
             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-9"
 | 
					 | 
				
			||||||
             sodipodi:nodetypes="sssscsss" /></g></g><text
 | 
					 | 
				
			||||||
         xml:space="preserve"
 | 
					 | 
				
			||||||
         transform="matrix(1.2936576,0,0,1.2936576,-614.37024,-444.76722)"
 | 
					 | 
				
			||||||
         id="text2099-9-3-6-4-2"
 | 
					 | 
				
			||||||
         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;white-space:pre;shape-inside:url(#rect2101-9-8-3-8-7);display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:15.1181;stroke-linecap:round;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"><tspan
 | 
					 | 
				
			||||||
           x="567.45703"
 | 
					 | 
				
			||||||
           y="402.89793"
 | 
					 | 
				
			||||||
           id="tspan3869">Daisy</tspan></text></g><rect
 | 
					 | 
				
			||||||
       style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:5.40518;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1"
 | 
					 | 
				
			||||||
       id="rect1146-6-2"
 | 
					 | 
				
			||||||
       width="317.5"
 | 
					 | 
				
			||||||
       height="105.83333"
 | 
					 | 
				
			||||||
       x="0"
 | 
					 | 
				
			||||||
       y="119.0625"
 | 
					 | 
				
			||||||
       inkscape:export-filename="rect1146-6-2.png"
 | 
					 | 
				
			||||||
       inkscape:export-xdpi="96"
 | 
					 | 
				
			||||||
       inkscape:export-ydpi="96" /><g
 | 
					 | 
				
			||||||
       id="g6067-0"
 | 
					 | 
				
			||||||
       inkscape:export-filename="g6067.png"
 | 
					 | 
				
			||||||
       inkscape:export-xdpi="96"
 | 
					 | 
				
			||||||
       inkscape:export-ydpi="96"
 | 
					 | 
				
			||||||
       transform="translate(61.954552,120.18292)"><g
 | 
					 | 
				
			||||||
         id="g1657-2-9"
 | 
					 | 
				
			||||||
         transform="matrix(3.2163178,0,0,3.2163178,-409.57698,470.69872)"
 | 
					 | 
				
			||||||
         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><text
 | 
					 | 
				
			||||||
         xml:space="preserve"
 | 
					 | 
				
			||||||
         transform="matrix(1.2936576,0,0,1.2936576,-687.45093,-446.93709)"
 | 
					 | 
				
			||||||
         id="text2099-9-3-6-4-8"
 | 
					 | 
				
			||||||
         style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;white-space:pre;shape-inside:url(#rect2101-9-8-3-8-27);display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:15.1181;stroke-linecap:round;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"><tspan
 | 
					 | 
				
			||||||
           x="567.45703"
 | 
					 | 
				
			||||||
           y="402.89793"
 | 
					 | 
				
			||||||
           id="tspan3871">Daisy</tspan></text></g></g></svg>
 | 
					 | 
				
			||||||
| 
		 Before Width: | Height: | Size: 15 KiB  | 
							
								
								
									
										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"
 | 
				
			||||||
							
								
								
									
										156
									
								
								server/site/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,156 @@
 | 
				
			|||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<html>
 | 
				
			||||||
 | 
						<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"/>
 | 
				
			||||||
 | 
							<link rel="stylesheet" href="node_modules/xterm/css/xterm.css" />
 | 
				
			||||||
 | 
							<script src="node_modules/xterm/lib/xterm.js"></script>
 | 
				
			||||||
 | 
							<style>
 | 
				
			||||||
 | 
								@font-face {
 | 
				
			||||||
 | 
									font-family: Fantasque;
 | 
				
			||||||
 | 
									src: url("resources/Fantasque.ttf") format("opentype");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								html, body {
 | 
				
			||||||
 | 
									color: #FFFFFF;
 | 
				
			||||||
 | 
									background-color: #272A30;
 | 
				
			||||||
 | 
									font-size: 14pt;
 | 
				
			||||||
 | 
									font-family: Fantasque;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									margin: 0;
 | 
				
			||||||
 | 
									padding: 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									height: 100vh;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								body {
 | 
				
			||||||
 | 
									max-width: 1000px; 
 | 
				
			||||||
 | 
									margin: 0 auto !important; 
 | 
				
			||||||
 | 
									float: none !important; 
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								a {
 | 
				
			||||||
 | 
									font-size: 12pt;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								a:link, a:visited {
 | 
				
			||||||
 | 
									color: #00B6B6;
 | 
				
			||||||
 | 
									text-decoration: none;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								a:hover, a:active {
 | 
				
			||||||
 | 
									color: #04F1F1;
 | 
				
			||||||
 | 
									text-decoration: underline;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								#terminal {
 | 
				
			||||||
 | 
									width: 90%;
 | 
				
			||||||
 | 
									height: auto;
 | 
				
			||||||
 | 
									margin: 0 auto !important; 
 | 
				
			||||||
 | 
									padding: 20px;
 | 
				
			||||||
 | 
									background: #1D1F21;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									box-sizing: box;
 | 
				
			||||||
 | 
									border: 0mm;
 | 
				
			||||||
 | 
									box-shadow: 0px 0px 10px 4px #3c4044;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								#header {
 | 
				
			||||||
 | 
									padding-top: 20px;
 | 
				
			||||||
 | 
									padding-bottom: 20px;
 | 
				
			||||||
 | 
									width: 90%;
 | 
				
			||||||
 | 
									margin: 0 auto !important; 
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								#footer {
 | 
				
			||||||
 | 
									padding-top: 20px;
 | 
				
			||||||
 | 
									padding-bottom: 20px;
 | 
				
			||||||
 | 
									width: 90%;
 | 
				
			||||||
 | 
									margin: 0 auto !important; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									text-align: center;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								#banner {
 | 
				
			||||||
 | 
									width: 40%;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							</style>
 | 
				
			||||||
 | 
						</head>
 | 
				
			||||||
 | 
						<body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<div id="header">
 | 
				
			||||||
 | 
								<img id="banner" src = "resources/daisy-light.svg" alt="Daisy Banner"/>
 | 
				
			||||||
 | 
								<p>A high-precision, general-purpose scientific calculator</p>
 | 
				
			||||||
 | 
							</div>
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							<div id="terminal"></div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<div id="footer">
 | 
				
			||||||
 | 
								<a href="https://github.com/rm-dr/daisy" target="_blank" rel="noopener noreferrer">Source Code</a> |
 | 
				
			||||||
 | 
								<a href="https://github.com/rm-dr/daisy#-usage" target="_blank" rel="noopener noreferrer">Documentation</a> |
 | 
				
			||||||
 | 
								<a href="https://github.com/rm-dr/daisy/blob/master/LICENSE" target="_blank" rel="noopener noreferrer">License</a>
 | 
				
			||||||
 | 
								<br>
 | 
				
			||||||
 | 
								<a href="https://crates.io/crates/daisycalc" target="_blank" rel="noopener noreferrer">crates.io</a> |
 | 
				
			||||||
 | 
								<a href="https://aur.archlinux.org/packages/daisy" target="_blank" rel="noopener noreferrer">AUR</a>
 | 
				
			||||||
 | 
							</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">
 | 
				
			||||||
 | 
								// See wasm-pack docs
 | 
				
			||||||
 | 
								// Build with `wasm-pack build --release --target web --out-dir pkg`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								import init, { daisy_init, daisy_free, daisy_char, daisy_prompt } from './pkg/daisycalc.js';
 | 
				
			||||||
 | 
								await init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								const term = new Terminal({
 | 
				
			||||||
 | 
									"fontFamily": "Fantasque",
 | 
				
			||||||
 | 
									"rows": 32,
 | 
				
			||||||
 | 
									"fontSize": 16,
 | 
				
			||||||
 | 
									"tabStopWidth": 8,
 | 
				
			||||||
 | 
									"cursorBlink": true,
 | 
				
			||||||
 | 
									"theme": {
 | 
				
			||||||
 | 
										"background": "#1D1F21",
 | 
				
			||||||
 | 
										"foreground": "#F8F8F8",
 | 
				
			||||||
 | 
										"cursor": "#F8F8F2",
 | 
				
			||||||
 | 
										"black": "#282828",
 | 
				
			||||||
 | 
										"blue": "#0087AF",
 | 
				
			||||||
 | 
										"brightBlack": "#555555",
 | 
				
			||||||
 | 
										"brightBlue": "#87DFFF",
 | 
				
			||||||
 | 
										"brightCyan": "#28D1E7",
 | 
				
			||||||
 | 
										"brightGreen": "#A8FF60",
 | 
				
			||||||
 | 
										"brightMagenta": "#985EFF",
 | 
				
			||||||
 | 
										"brightRed": "#FFAA00",
 | 
				
			||||||
 | 
										"brightWhite": "#D0D0D0",
 | 
				
			||||||
 | 
										"brightYellow": "#F1FF52",
 | 
				
			||||||
 | 
										"cyan": "#87DFEB",
 | 
				
			||||||
 | 
										"green": "#B4EC85",
 | 
				
			||||||
 | 
										"magenta": "#BD99FF",
 | 
				
			||||||
 | 
										"red": "#FF6600",
 | 
				
			||||||
 | 
										"white": "#F8F8F8",
 | 
				
			||||||
 | 
										"yellow": "#FFFFB6"
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								term.open(document.getElementById("terminal"));
 | 
				
			||||||
 | 
								const state = daisy_init();
 | 
				
			||||||
 | 
								term.write(daisy_char(state, "h"));
 | 
				
			||||||
 | 
								term.write(daisy_char(state, "e"));
 | 
				
			||||||
 | 
								term.write(daisy_char(state, "l"));
 | 
				
			||||||
 | 
								term.write(daisy_char(state, "p"));
 | 
				
			||||||
 | 
								term.write(daisy_char(state, "\r"));
 | 
				
			||||||
 | 
								term.focus();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								term.onData( data => { term.write(daisy_char(state, data)); });
 | 
				
			||||||
 | 
							</script>
 | 
				
			||||||
 | 
						</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
							
								
								
									
										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
									
								
							
							
						
						
							
								
								
									
										137
									
								
								server/site/resources/banner.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,137 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
				
			||||||
 | 
					<!-- Created with Inkscape (http://www.inkscape.org/) -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<svg
 | 
				
			||||||
 | 
					   width="3600"
 | 
				
			||||||
 | 
					   height="400"
 | 
				
			||||||
 | 
					   viewBox="0 0 952.49994 105.83334"
 | 
				
			||||||
 | 
					   version="1.1"
 | 
				
			||||||
 | 
					   id="svg3246"
 | 
				
			||||||
 | 
					   inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
 | 
				
			||||||
 | 
					   sodipodi:docname="banner.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.38377228"
 | 
				
			||||||
 | 
					     inkscape:cx="1911.2897"
 | 
				
			||||||
 | 
					     inkscape:cy="665.75939"
 | 
				
			||||||
 | 
					     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(93.034294,223.72656)"><g
 | 
				
			||||||
 | 
					       id="g1657-2-2"
 | 
				
			||||||
 | 
					       transform="matrix(3.2163178,0,0,3.2163178,-196.23741,245.9227)"
 | 
				
			||||||
 | 
					       style="stroke:#a60d66;stroke-opacity:1"><g
 | 
				
			||||||
 | 
					         id="g2349-6-0-0"
 | 
				
			||||||
 | 
					         style="stroke:#ea004d;stroke-opacity:1"
 | 
				
			||||||
 | 
					         transform="translate(125.41922,-167.998)"><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-2"
 | 
				
			||||||
 | 
					           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-3"
 | 
				
			||||||
 | 
					           sodipodi:nodetypes="sssscsss" /></g><g
 | 
				
			||||||
 | 
					         id="g1649-9-7"
 | 
				
			||||||
 | 
					         style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1"><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-5"
 | 
				
			||||||
 | 
					           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-9"
 | 
				
			||||||
 | 
					           sodipodi:nodetypes="sssscsss" /></g></g><path
 | 
				
			||||||
 | 
					       d="M 572.88931,400.21164 V 364.3347 q 0,-2.86538 2.50721,-2.86538 h 14.3269 q 3.52202,0 6.26801,0.41787 2.80569,0.41787 5.73076,1.73117 2.98477,1.3133 4.95472,3.58172 1.96995,2.20873 3.22355,6.14863 1.2536,3.8802 1.2536,9.19309 0,5.55167 -1.55208,9.55127 -1.55208,3.99959 -3.70111,6.02923 -2.08934,2.02964 -5.31289,3.22355 -3.16386,1.13421 -5.31289,1.373 -2.14904,0.17908 -4.89503,0.17908 H 575.6353 q -1.3133,0 -2.02964,-0.53726 -0.71635,-0.53725 -0.71635,-2.14903 z m 8.29766,-2.44751 h 6.62619 q 2.92508,0 4.83533,-0.17909 1.91025,-0.23878 4.23837,-1.37299 2.38782,-1.13421 3.82051,-3.22355 2.02964,-3.10416 2.14903,-9.25279 v -0.65665 q 0,-2.86538 -0.17908,-4.65624 -0.11939,-1.79086 -0.83574,-4.17868 -0.65665,-2.44751 -1.96995,-3.8802 -1.3133,-1.43269 -3.8802,-2.50721 -2.5072,-1.13421 -6.08893,-1.2536 h -8.65583 l -0.0597,1.73117 z m 35.45911,-3.04447 q 0,-2.32812 1.37299,-4.05928 1.373,-1.73117 3.28325,-2.6863 1.96995,-0.95512 4.59655,-1.49238 2.68629,-0.59696 4.59654,-0.77604 1.96995,-0.17909 3.9399,-0.17909 v -1.2536 q 0,-2.5669 -0.83574,-4.05929 -0.83573,-1.49238 -3.40264,-1.49238 -2.32812,0 -4.23837,0.65665 -1.91025,0.59695 -2.86538,1.37299 -0.89543,0.77604 -1.73116,1.43269 -0.77604,0.65665 -1.13422,0.65665 l -0.23878,-0.0597 -0.23878,-0.17908 q -0.17909,-0.29848 -0.35817,-1.43269 -0.11939,-1.19391 -0.17909,-2.14904 l -0.0597,-1.01482 q 0,-0.29848 0,-0.41787 0.0597,-0.17908 0.23878,-0.35817 0.17908,-0.17909 0.23878,-0.23878 0.11939,-0.0597 0.53726,-0.23878 0.41787,-0.17909 0.65665,-0.29848 4.29807,-1.91025 9.37217,-1.91025 6.80528,0 9.55127,2.5669 2.80568,2.5669 2.80568,7.40223 v 15.69989 q 0,2.68629 -2.68629,2.68629 h -2.86538 q -1.3133,0 -1.91025,-0.71634 -0.53726,-0.71635 -0.53726,-1.67147 -3.9399,3.04446 -9.19309,3.04446 -3.99959,0 -6.38741,-2.74599 -2.32812,-2.74598 -2.32812,-6.08893 z m 7.8201,0 q 0,1.73117 1.13421,3.10416 1.13421,1.373 2.98477,1.373 2.02964,0 3.9399,-1.25361 1.91025,-1.31329 1.91025,-4.23837 v -4.65624 q -1.85056,0.17909 -3.16386,0.41787 -1.3133,0.17908 -3.10416,0.77604 -1.79086,0.53726 -2.74599,1.73116 -0.95512,1.13422 -0.95512,2.74599 z m 25.07204,-29.19105 v -2.98477 q 0,-0.95512 0.17909,-1.55208 0.23878,-0.59695 0.77604,-0.83573 0.53726,-0.23879 0.77604,-0.23879 0.29848,-0.0597 0.95513,-0.11939 h 3.04446 q 1.25361,0 1.96995,0.59696 0.77604,0.53726 0.77604,2.14903 v 3.10416 q 0,0.47757 -0.11939,0.89543 -0.0597,0.35818 -0.23878,0.65665 -0.11939,0.23878 -0.35817,0.47757 -0.17909,0.17908 -0.41787,0.29847 -0.17909,0.0597 -0.47756,0.17909 -0.23879,0.0597 -0.41787,0.0597 -0.11939,0 -0.35817,0.0597 h -0.23879 -3.10416 q -1.2536,0 -2.02964,-0.53726 -0.71635,-0.59695 -0.71635,-2.20873 z m 0.23879,34.38455 v -21.66943 q 0,-2.68629 2.62659,-2.68629 h 2.44752 q 1.31329,0 1.96994,0.47756 0.71635,0.47757 0.83574,1.01482 0.11939,0.53726 0.11939,1.49239 v 21.66943 q 0,2.68629 -2.6266,2.68629 h -2.74599 q -1.2536,0 -1.91025,-0.59695 -0.59695,-0.59696 -0.65665,-1.07452 -0.0597,-0.47756 -0.0597,-1.3133 z m 13.4911,0 q 0,-0.23878 0.71635,-4.17868 0.17909,-1.37299 0.83573,-1.37299 0.29848,0 1.373,1.13421 1.13421,1.07452 3.28325,2.20873 2.14903,1.13422 4.95471,1.13422 4.65625,0 4.65625,-3.16386 0,-1.67147 -1.43269,-2.44751 -1.43269,-0.77604 -4.17868,-1.19391 -2.74599,-0.47756 -3.70112,-0.83574 -2.32812,-0.89543 -4.29807,-2.86537 -1.91025,-1.96995 -1.91025,-5.1935 0,-8.35736 10.02883,-8.59614 h 1.55208 q 3.8205,0.0597 7.28284,1.49238 0.89543,0.35818 1.13421,0.59696 0.29848,0.23878 0.29848,0.83573 0,0.35817 -0.59696,3.76081 -0.23878,0.89543 -0.71634,0.89543 -0.41787,0 -1.43269,-0.77604 -0.95513,-0.83573 -2.80568,-1.61177 -1.85056,-0.83574 -4.41746,-0.83574 -4.41746,0 -4.41746,2.86538 0,1.55208 1.67147,2.26843 1.67147,0.71634 4.47715,1.2536 2.86538,0.47756 4.17868,1.19391 1.13421,0.53726 2.14903,1.37299 1.01483,0.83574 2.02965,2.68629 1.07452,1.79087 1.07452,3.9996 0,5.01441 -2.86538,7.04405 -2.86538,1.96995 -7.8798,1.96995 -6.20832,0 -10.68547,-2.86538 l -0.23879,-0.29847 q -0.11939,-0.35818 -0.11939,-0.47757 z m 25.13182,-22.86334 q 0,-1.49238 2.02965,-1.49238 h 2.02964 q 2.14903,0 3.22355,1.43269 0.29848,0.29848 1.73117,3.40264 1.49238,3.04446 3.16385,7.40223 1.67147,4.29807 2.08934,6.92466 0.23878,-3.10416 4.47716,-15.69989 0.83573,-2.26842 1.49238,-2.80568 0.83574,-0.65665 2.38782,-0.65665 h 1.67147 q 2.08934,0 2.08934,1.61178 0,0.41786 -0.23878,1.13421 l -9.25279,26.92262 q -0.77604,2.20873 -1.19391,3.04447 -3.46233,6.92467 -10.14822,6.92467 -3.76081,0 -4.53685,-0.77605 -0.29847,-0.29847 -0.59695,-4.11898 -0.0597,-1.13421 0.29848,-1.49238 l 0.29847,-0.11939 h 0.23879 q 0.23878,0.0597 0.89543,0.41786 0.71634,0.41787 1.61177,0.65665 0.89543,0.29848 1.96995,0.29848 1.2536,0 2.14903,-0.53726 0.95513,-0.53726 1.49239,-1.49238 0.59695,-0.95513 1.01482,-2.02965 0.41787,-1.01482 0.77604,-2.14903 0.11939,-0.41787 0.17909,-0.65665 0.0597,-0.53726 -0.23878,-1.13421 l -10.56609,-23.3409 q -0.53726,-1.19391 -0.53726,-1.67148 z"
 | 
				
			||||||
 | 
					       id="text2099-9-3-6-4-2"
 | 
				
			||||||
 | 
					       style="font-weight:bold;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;white-space:pre;fill:#ffffff;stroke-width:15.1181;stroke-linecap:round;stroke-linejoin:bevel"
 | 
				
			||||||
 | 
					       transform="matrix(1.2936576,0,0,1.2936576,-401.03067,-669.54324)"
 | 
				
			||||||
 | 
					       aria-label="Daisy" /></g></svg>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 11 KiB  | 
							
								
								
									
										137
									
								
								server/site/resources/daisy-dark.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,137 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
				
			||||||
 | 
					<!-- Created with Inkscape (http://www.inkscape.org/) -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<svg
 | 
				
			||||||
 | 
					   width="1463.4203"
 | 
				
			||||||
 | 
					   height="400.00003"
 | 
				
			||||||
 | 
					   viewBox="0 0 387.19659 105.83335"
 | 
				
			||||||
 | 
					   version="1.1"
 | 
				
			||||||
 | 
					   id="svg3246"
 | 
				
			||||||
 | 
					   inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
 | 
				
			||||||
 | 
					   sodipodi:docname="daisy-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="2560"
 | 
				
			||||||
 | 
					     inkscape:window-height="1384"
 | 
				
			||||||
 | 
					     inkscape:window-x="0"
 | 
				
			||||||
 | 
					     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><path
 | 
				
			||||||
 | 
					       d="m 152.46104,212.70512 v -63.97971 q 0,-5.10986 4.47113,-5.10986 h 25.5493 q 6.28086,0 11.17781,0.7452 5.00341,0.74519 10.21972,3.08721 5.32277,2.34202 8.8358,6.38731 3.51303,3.93885 5.74859,10.96492 2.23555,6.9196 2.23555,16.39413 0,9.90034 -2.76784,17.03287 -2.76784,7.13251 -6.60022,10.75198 -3.72594,3.61948 -9.47453,5.74859 -5.64214,2.02265 -9.47453,2.44849 -3.8324,0.31935 -8.72935,0.31935 h -26.29448 q -2.34202,0 -3.61948,-0.9581 -1.27747,-0.95808 -1.27747,-3.83238 z m 14.7973,-4.36467 h 11.81655 q 5.21632,0 8.62289,-0.31938 3.40657,-0.42582 7.55833,-2.44846 4.25822,-2.02265 6.81315,-5.74859 3.61948,-5.53568 3.83239,-16.50059 v -1.17101 q 0,-5.10986 -0.31936,-8.30352 -0.21291,-3.19366 -1.49038,-7.45188 -1.17101,-4.36467 -3.51303,-6.9196 -2.34203,-2.55493 -6.9196,-4.47113 -4.47112,-2.02265 -10.85845,-2.23556 H 167.3648 l -0.10646,3.08721 z m 63.23458,-5.42924 q 0,-4.15176 2.44846,-7.23895 2.44849,-3.08721 5.85506,-4.79051 3.51303,-1.70327 8.19707,-2.66137 4.79049,-1.06457 8.19705,-1.38392 3.51304,-0.31937 7.02607,-0.31937 v -2.23556 q 0,-4.57758 -1.49039,-7.23897 -1.49036,-2.66138 -6.06796,-2.66138 -4.15176,0 -7.55833,1.17101 -3.40656,1.06455 -5.10986,2.44847 -1.59682,1.38392 -3.08719,2.55493 -1.38392,1.17101 -2.02267,1.17101 l -0.42581,-0.10647 -0.42582,-0.31935 q -0.31938,-0.53228 -0.63873,-2.55493 -0.21291,-2.12911 -0.31937,-3.83241 l -0.10647,-1.80973 q 0,-0.53229 0,-0.7452 0.10647,-0.31935 0.42582,-0.63872 0.31936,-0.31938 0.42582,-0.42582 0.21291,-0.10647 0.9581,-0.42582 0.74519,-0.31937 1.17101,-0.53228 7.66479,-3.40657 16.71348,-3.40657 12.13593,0 17.03288,4.57758 5.00339,4.57758 5.00339,13.20047 v 27.99777 q 0,4.79048 -4.79048,4.79048 h -5.10986 q -2.34202,0 -3.40657,-1.27745 -0.9581,-1.27748 -0.9581,-2.98075 -7.02606,5.42921 -16.39413,5.42921 -7.13251,0 -11.39073,-4.89695 -4.15176,-4.89693 -4.15176,-10.85845 z m 13.94566,0 q 0,3.08722 2.02265,5.53568 2.02264,2.44849 5.32277,2.44849 3.61947,0 7.02606,-2.23558 3.40657,-2.342 3.40657,-7.55833 v -8.30351 q -3.30013,0.31937 -5.64215,0.74519 -2.34202,0.31935 -5.53568,1.38392 -3.19365,0.9581 -4.89695,3.08719 -1.70327,2.02267 -1.70327,4.89695 z m 44.71122,-52.05668 v -5.32277 q 0,-1.70328 0.31937,-2.76784 0.42582,-1.06455 1.38392,-1.49037 0.9581,-0.42584 1.38392,-0.42584 0.53228,-0.10646 1.70329,-0.2129 h 5.42922 q 2.23557,0 3.51303,1.06456 1.38392,0.9581 1.38392,3.83239 v 5.53568 q 0,0.85165 -0.21291,1.59682 -0.10647,0.63875 -0.42582,1.17101 -0.21291,0.42582 -0.63873,0.85166 -0.31937,0.31936 -0.74519,0.53226 -0.31937,0.10647 -0.85164,0.31938 -0.42583,0.10646 -0.74519,0.10646 -0.21291,0 -0.63873,0.10646 h -0.42583 -5.53568 q -2.23556,0 -3.61948,-0.9581 -1.27747,-1.06454 -1.27747,-3.93885 z m 0.42583,61.3183 v -38.64331 q 0,-4.79048 4.68403,-4.79048 h 4.36468 q 2.34201,0 3.51302,0.85163 1.27747,0.85166 1.49038,1.80974 0.21291,0.9581 0.21291,2.6614 v 38.64331 q 0,4.79048 -4.68404,4.79048 h -4.89695 q -2.23556,0 -3.40657,-1.06454 -1.06455,-1.06457 -1.17101,-1.91621 -0.10647,-0.85163 -0.10647,-2.34202 z m 24.05881,0 q 0,-0.42582 1.27748,-7.45188 0.31937,-2.44846 1.49036,-2.44846 0.53229,0 2.44849,2.02264 2.02265,1.91621 5.85505,3.93885 3.83239,2.02267 8.83578,2.02267 8.30354,0 8.30354,-5.64214 0,-2.98075 -2.55493,-4.36467 -2.55493,-1.38392 -7.45188,-2.12911 -4.89695,-0.85164 -6.60025,-1.49039 -4.15176,-1.59683 -7.66479,-5.10984 -3.40656,-3.51303 -3.40656,-9.26162 0,-14.90376 17.88451,-15.32958 h 2.76784 q 6.81313,0.10646 12.98756,2.66137 1.59683,0.63875 2.02264,1.06457 0.53229,0.42582 0.53229,1.49037 0,0.63872 -1.06457,6.70668 -0.42582,1.59683 -1.27745,1.59683 -0.7452,0 -2.55493,-1.38392 -1.7033,-1.49036 -5.0034,-2.87428 -3.30012,-1.49038 -7.8777,-1.49038 -7.8777,0 -7.8777,5.10986 0,2.76784 2.98075,4.04531 2.98075,1.27746 7.98414,2.23556 5.10986,0.85163 7.45189,2.12911 2.02264,0.9581 3.83238,2.44846 1.80976,1.49039 3.6195,4.79049 1.9162,3.19368 1.9162,7.13253 0,8.94224 -5.10986,12.56172 -5.10986,3.51303 -14.05213,3.51303 -11.07136,0 -19.0555,-5.10986 l -0.42584,-0.53226 q -0.21291,-0.63875 -0.21291,-0.85166 z m 44.81783,-40.77242 q 0,-2.66137 3.61949,-2.66137 h 3.61948 q 3.83238,0 5.74859,2.55493 0.53228,0.53228 3.08721,6.06796 2.66137,5.42921 5.64212,13.20047 2.98075,7.66479 3.72594,12.34881 0.42582,-5.53568 7.98417,-27.99777 1.49036,-4.04529 2.66137,-5.00339 1.49039,-1.17101 4.25823,-1.17101 h 2.98075 q 3.72594,0 3.72594,2.8743 0,0.74517 -0.42582,2.02265 l -16.50059,48.01137 q -1.38392,3.93885 -2.12912,5.42924 -6.1744,12.34883 -18.09742,12.34883 -6.70669,0 -8.09061,-1.38394 -0.53226,-0.53226 -1.06454,-7.34542 -0.10647,-2.02265 0.53228,-2.66137 l 0.53226,-0.21291 h 0.42584 q 0.42582,0.10646 1.59683,0.74517 1.27746,0.74519 2.87429,1.17101 1.59682,0.53228 3.51303,0.53228 2.23555,0 3.83238,-0.9581 1.7033,-0.9581 2.6614,-2.66137 1.06454,-1.7033 1.80974,-3.6195 0.74519,-1.80974 1.38391,-3.83238 0.21291,-0.7452 0.31938,-1.17101 0.10646,-0.95811 -0.42582,-2.02265 l -18.84261,-41.62406 q -0.9581,-2.12911 -0.9581,-2.98077 z"
 | 
				
			||||||
 | 
					       id="text2099-9-3-6-4-8"
 | 
				
			||||||
 | 
					       style="font-weight:bold;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;white-space:pre;stroke-width:26.9603;stroke-linecap:round;stroke-linejoin:bevel"
 | 
				
			||||||
 | 
					       aria-label="Daisy" /></g></svg>
 | 
				
			||||||
| 
		 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  | 
							
								
								
									
										137
									
								
								server/site/resources/daisy-light.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,137 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="no"?>
 | 
				
			||||||
 | 
					<!-- Created with Inkscape (http://www.inkscape.org/) -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<svg
 | 
				
			||||||
 | 
					   width="1463.4203"
 | 
				
			||||||
 | 
					   height="400.00003"
 | 
				
			||||||
 | 
					   viewBox="0 0 387.19659 105.83335"
 | 
				
			||||||
 | 
					   version="1.1"
 | 
				
			||||||
 | 
					   id="svg3246"
 | 
				
			||||||
 | 
					   inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
 | 
				
			||||||
 | 
					   sodipodi:docname="daisy-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="0.31455847"
 | 
				
			||||||
 | 
					     inkscape:cx="650.11761"
 | 
				
			||||||
 | 
					     inkscape:cy="364.00228"
 | 
				
			||||||
 | 
					     inkscape:window-width="2560"
 | 
				
			||||||
 | 
					     inkscape:window-height="1384"
 | 
				
			||||||
 | 
					     inkscape:window-x="0"
 | 
				
			||||||
 | 
					     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:#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><path
 | 
				
			||||||
 | 
					       d="m 152.46104,212.70512 v -63.97971 q 0,-5.10986 4.47113,-5.10986 h 25.5493 q 6.28086,0 11.17781,0.7452 5.00341,0.74519 10.21972,3.08721 5.32277,2.34202 8.8358,6.38731 3.51303,3.93885 5.74859,10.96492 2.23555,6.9196 2.23555,16.39413 0,9.90034 -2.76784,17.03287 -2.76784,7.13251 -6.60022,10.75198 -3.72594,3.61948 -9.47453,5.74859 -5.64214,2.02265 -9.47453,2.44849 -3.8324,0.31935 -8.72935,0.31935 h -26.29448 q -2.34202,0 -3.61948,-0.9581 -1.27747,-0.95808 -1.27747,-3.83238 z m 14.7973,-4.36467 h 11.81655 q 5.21632,0 8.62289,-0.31938 3.40657,-0.42582 7.55833,-2.44846 4.25822,-2.02265 6.81315,-5.74859 3.61948,-5.53568 3.83239,-16.50059 v -1.17101 q 0,-5.10986 -0.31936,-8.30352 -0.21291,-3.19366 -1.49038,-7.45188 -1.17101,-4.36467 -3.51303,-6.9196 -2.34203,-2.55493 -6.9196,-4.47113 -4.47112,-2.02265 -10.85845,-2.23556 H 167.3648 l -0.10646,3.08721 z m 63.23458,-5.42924 q 0,-4.15176 2.44846,-7.23895 2.44849,-3.08721 5.85506,-4.79051 3.51303,-1.70327 8.19707,-2.66137 4.79049,-1.06457 8.19705,-1.38392 3.51304,-0.31937 7.02607,-0.31937 v -2.23556 q 0,-4.57758 -1.49039,-7.23897 -1.49036,-2.66138 -6.06796,-2.66138 -4.15176,0 -7.55833,1.17101 -3.40656,1.06455 -5.10986,2.44847 -1.59682,1.38392 -3.08719,2.55493 -1.38392,1.17101 -2.02267,1.17101 l -0.42581,-0.10647 -0.42582,-0.31935 q -0.31938,-0.53228 -0.63873,-2.55493 -0.21291,-2.12911 -0.31937,-3.83241 l -0.10647,-1.80973 q 0,-0.53229 0,-0.7452 0.10647,-0.31935 0.42582,-0.63872 0.31936,-0.31938 0.42582,-0.42582 0.21291,-0.10647 0.9581,-0.42582 0.74519,-0.31937 1.17101,-0.53228 7.66479,-3.40657 16.71348,-3.40657 12.13593,0 17.03288,4.57758 5.00339,4.57758 5.00339,13.20047 v 27.99777 q 0,4.79048 -4.79048,4.79048 h -5.10986 q -2.34202,0 -3.40657,-1.27745 -0.9581,-1.27748 -0.9581,-2.98075 -7.02606,5.42921 -16.39413,5.42921 -7.13251,0 -11.39073,-4.89695 -4.15176,-4.89693 -4.15176,-10.85845 z m 13.94566,0 q 0,3.08722 2.02265,5.53568 2.02264,2.44849 5.32277,2.44849 3.61947,0 7.02606,-2.23558 3.40657,-2.342 3.40657,-7.55833 v -8.30351 q -3.30013,0.31937 -5.64215,0.74519 -2.34202,0.31935 -5.53568,1.38392 -3.19365,0.9581 -4.89695,3.08719 -1.70327,2.02267 -1.70327,4.89695 z m 44.71122,-52.05668 v -5.32277 q 0,-1.70328 0.31937,-2.76784 0.42582,-1.06455 1.38392,-1.49037 0.9581,-0.42584 1.38392,-0.42584 0.53228,-0.10646 1.70329,-0.2129 h 5.42922 q 2.23557,0 3.51303,1.06456 1.38392,0.9581 1.38392,3.83239 v 5.53568 q 0,0.85165 -0.21291,1.59682 -0.10647,0.63875 -0.42582,1.17101 -0.21291,0.42582 -0.63873,0.85166 -0.31937,0.31936 -0.74519,0.53226 -0.31937,0.10647 -0.85164,0.31938 -0.42583,0.10646 -0.74519,0.10646 -0.21291,0 -0.63873,0.10646 h -0.42583 -5.53568 q -2.23556,0 -3.61948,-0.9581 -1.27747,-1.06454 -1.27747,-3.93885 z m 0.42583,61.3183 v -38.64331 q 0,-4.79048 4.68403,-4.79048 h 4.36468 q 2.34201,0 3.51302,0.85163 1.27747,0.85166 1.49038,1.80974 0.21291,0.9581 0.21291,2.6614 v 38.64331 q 0,4.79048 -4.68404,4.79048 h -4.89695 q -2.23556,0 -3.40657,-1.06454 -1.06455,-1.06457 -1.17101,-1.91621 -0.10647,-0.85163 -0.10647,-2.34202 z m 24.05881,0 q 0,-0.42582 1.27748,-7.45188 0.31937,-2.44846 1.49036,-2.44846 0.53229,0 2.44849,2.02264 2.02265,1.91621 5.85505,3.93885 3.83239,2.02267 8.83578,2.02267 8.30354,0 8.30354,-5.64214 0,-2.98075 -2.55493,-4.36467 -2.55493,-1.38392 -7.45188,-2.12911 -4.89695,-0.85164 -6.60025,-1.49039 -4.15176,-1.59683 -7.66479,-5.10984 -3.40656,-3.51303 -3.40656,-9.26162 0,-14.90376 17.88451,-15.32958 h 2.76784 q 6.81313,0.10646 12.98756,2.66137 1.59683,0.63875 2.02264,1.06457 0.53229,0.42582 0.53229,1.49037 0,0.63872 -1.06457,6.70668 -0.42582,1.59683 -1.27745,1.59683 -0.7452,0 -2.55493,-1.38392 -1.7033,-1.49036 -5.0034,-2.87428 -3.30012,-1.49038 -7.8777,-1.49038 -7.8777,0 -7.8777,5.10986 0,2.76784 2.98075,4.04531 2.98075,1.27746 7.98414,2.23556 5.10986,0.85163 7.45189,2.12911 2.02264,0.9581 3.83238,2.44846 1.80976,1.49039 3.6195,4.79049 1.9162,3.19368 1.9162,7.13253 0,8.94224 -5.10986,12.56172 -5.10986,3.51303 -14.05213,3.51303 -11.07136,0 -19.0555,-5.10986 l -0.42584,-0.53226 q -0.21291,-0.63875 -0.21291,-0.85166 z m 44.81783,-40.77242 q 0,-2.66137 3.61949,-2.66137 h 3.61948 q 3.83238,0 5.74859,2.55493 0.53228,0.53228 3.08721,6.06796 2.66137,5.42921 5.64212,13.20047 2.98075,7.66479 3.72594,12.34881 0.42582,-5.53568 7.98417,-27.99777 1.49036,-4.04529 2.66137,-5.00339 1.49039,-1.17101 4.25823,-1.17101 h 2.98075 q 3.72594,0 3.72594,2.8743 0,0.74517 -0.42582,2.02265 l -16.50059,48.01137 q -1.38392,3.93885 -2.12912,5.42924 -6.1744,12.34883 -18.09742,12.34883 -6.70669,0 -8.09061,-1.38394 -0.53226,-0.53226 -1.06454,-7.34542 -0.10647,-2.02265 0.53228,-2.66137 l 0.53226,-0.21291 h 0.42584 q 0.42582,0.10646 1.59683,0.74517 1.27746,0.74519 2.87429,1.17101 1.59682,0.53228 3.51303,0.53228 2.23555,0 3.83238,-0.9581 1.7033,-0.9581 2.6614,-2.66137 1.06454,-1.7033 1.80974,-3.6195 0.74519,-1.80974 1.38391,-3.83238 0.21291,-0.7452 0.31938,-1.17101 0.10646,-0.95811 -0.42582,-2.02265 l -18.84261,-41.62406 q -0.9581,-2.12911 -0.9581,-2.98077 z"
 | 
				
			||||||
 | 
					       id="text2099-9-3-6-4-8"
 | 
				
			||||||
 | 
					       style="font-weight:bold;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;white-space:pre;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:26.9603;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1"
 | 
				
			||||||
 | 
					       aria-label="Daisy" /></g></svg>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 11 KiB  | 
| 
		 Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB  | 
							
								
								
									
										22
									
								
								shell.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					{ nixpkgs ? import <nixpkgs> { }}:
 | 
				
			||||||
 | 
					let
 | 
				
			||||||
 | 
					  # 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 {
 | 
				
			||||||
 | 
					  buildInputs = with pkgs; [
 | 
				
			||||||
 | 
					    cargo
 | 
				
			||||||
 | 
					    rustc
 | 
				
			||||||
 | 
					    rustfmt
 | 
				
			||||||
 | 
					    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());
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
@@ -224,7 +247,7 @@ pub fn do_command(
 | 
				
			|||||||
			if args.len() != 2 {
 | 
								if args.len() != 2 {
 | 
				
			||||||
				return FormattedText::new(
 | 
									return FormattedText::new(
 | 
				
			||||||
					format!(
 | 
										format!(
 | 
				
			||||||
						"[c]{first}[n] [t]takes exactly two arguments.[n]\n\n",
 | 
											"[c]{first}[n] [t]takes exactly one argument.[n]\n\n",
 | 
				
			||||||
					)
 | 
										)
 | 
				
			||||||
				);
 | 
									);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,7 +19,7 @@ pub struct Config {
 | 
				
			|||||||
	// with prettier unicode alternatives?
 | 
						// with prettier unicode alternatives?
 | 
				
			||||||
	//
 | 
						//
 | 
				
			||||||
	// Automatically disabled if enable_unicode is off.
 | 
						// Automatically disabled if enable_unicode is off.
 | 
				
			||||||
	//pub enable_substituion: bool,
 | 
						pub enable_substituion: bool,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Should we print simple powers
 | 
						// Should we print simple powers
 | 
				
			||||||
	// as unicode superscript chars?
 | 
						// as unicode superscript chars?
 | 
				
			||||||
@@ -38,7 +38,7 @@ impl Config {
 | 
				
			|||||||
	pub fn new() -> Config {
 | 
						pub fn new() -> Config {
 | 
				
			||||||
		Config{
 | 
							Config{
 | 
				
			||||||
			term_color_type: 2,
 | 
								term_color_type: 2,
 | 
				
			||||||
			//enable_substituion: true,
 | 
								enable_substituion: true,
 | 
				
			||||||
			//enable_unicode: true,
 | 
								//enable_unicode: true,
 | 
				
			||||||
			enable_super_powers: true,
 | 
								enable_super_powers: true,
 | 
				
			||||||
			enable_one_over_power: true
 | 
								enable_one_over_power: true
 | 
				
			||||||
@@ -61,7 +61,7 @@ impl Config {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Debug)]
 | 
					#[derive(Debug)]
 | 
				
			||||||
#[derive(Clone)]
 | 
					//#[derive(Clone)]
 | 
				
			||||||
pub struct Context {
 | 
					pub struct Context {
 | 
				
			||||||
	pub config: Config,
 | 
						pub config: Config,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -81,7 +81,7 @@ impl Context {
 | 
				
			|||||||
			history: Vec::new(),
 | 
								history: Vec::new(),
 | 
				
			||||||
			variables: HashMap::new(),
 | 
								variables: HashMap::new(),
 | 
				
			||||||
			functions: HashMap::new(),
 | 
								functions: HashMap::new(),
 | 
				
			||||||
			shadow: HashMap::new(),
 | 
								shadow: HashMap::new()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -126,6 +126,7 @@ impl Context {
 | 
				
			|||||||
		} else { panic!() }
 | 
							} else { panic!() }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Can we define a new variable with this name?
 | 
				
			||||||
	pub fn valid_varible(&self, s: &str) -> bool {
 | 
						pub fn valid_varible(&self, s: &str) -> bool {
 | 
				
			||||||
		if {
 | 
							if {
 | 
				
			||||||
			Function::from_string(s).is_some() ||
 | 
								Function::from_string(s).is_some() ||
 | 
				
			||||||
@@ -145,10 +146,17 @@ impl Context {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Can we get a value fro mthis variable name?
 | 
				
			||||||
	pub fn is_varible(&self, s: &str) -> bool {
 | 
						pub fn is_varible(&self, s: &str) -> bool {
 | 
				
			||||||
		return {
 | 
							return {
 | 
				
			||||||
 | 
								(
 | 
				
			||||||
 | 
									s == "ans" &&
 | 
				
			||||||
 | 
									self.history.len() != 0
 | 
				
			||||||
 | 
								) ||
 | 
				
			||||||
 | 
								(
 | 
				
			||||||
				self.valid_varible(s) &&
 | 
									self.valid_varible(s) &&
 | 
				
			||||||
				(self.variables.contains_key(s) || self.shadow.contains_key(s))
 | 
									(self.variables.contains_key(s) || self.shadow.contains_key(s))
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Select main script for target system
 | 
					 | 
				
			||||||
cfg_if::cfg_if! {
 | 
					 | 
				
			||||||
	if #[cfg(target_family = "unix")] {
 | 
					 | 
				
			||||||
		mod unix;
 | 
					 | 
				
			||||||
		pub use unix::main as main_e;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		pub fn main_e() -> Result<(), std::io::Error> {
 | 
					 | 
				
			||||||
			unimplemented!("Not yet implemented.");
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
mod unix;
 | 
					 | 
				
			||||||
mod promptbuffer;
 | 
					 | 
				
			||||||
pub use self::unix::main;
 | 
					 | 
				
			||||||
@@ -1,115 +0,0 @@
 | 
				
			|||||||
use std::io::stdout;
 | 
					 | 
				
			||||||
use std::io::stdin;
 | 
					 | 
				
			||||||
use std::env;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use termion::{
 | 
					 | 
				
			||||||
	event::Key,
 | 
					 | 
				
			||||||
	input::TermRead,
 | 
					 | 
				
			||||||
	raw::IntoRawMode,
 | 
					 | 
				
			||||||
	color::DetectColors
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use super::promptbuffer::PromptBuffer;
 | 
					 | 
				
			||||||
use crate::command;
 | 
					 | 
				
			||||||
use crate::context::Context;
 | 
					 | 
				
			||||||
use crate::FormattedText;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[inline(always)]
 | 
					 | 
				
			||||||
pub fn main() -> Result<(), std::io::Error> {
 | 
					 | 
				
			||||||
	let mut stdout = stdout().into_raw_mode().unwrap();
 | 
					 | 
				
			||||||
	let mut pb: PromptBuffer = PromptBuffer::new(64);
 | 
					 | 
				
			||||||
	let mut context = Context::new();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Set color compatibilty
 | 
					 | 
				
			||||||
	let term_colors = stdout.available_colors().unwrap_or(0);
 | 
					 | 
				
			||||||
	if term_colors >= 256 {
 | 
					 | 
				
			||||||
		context.config.term_color_type = 2
 | 
					 | 
				
			||||||
	} else if term_colors >= 8 {
 | 
					 | 
				
			||||||
		context.config.term_color_type = 1
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		context.config.term_color_type = 0
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	context.config.check();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Handle command-line arguments
 | 
					 | 
				
			||||||
	let args: Vec<String> = env::args().collect();
 | 
					 | 
				
			||||||
	if args.iter().any(|s| s == "--help") {
 | 
					 | 
				
			||||||
		let t = command::do_command(&mut context, &String::from("help"));
 | 
					 | 
				
			||||||
		t.write(&context, &mut stdout)?;
 | 
					 | 
				
			||||||
		return Ok(());
 | 
					 | 
				
			||||||
	} else if args.iter().any(|s| s == "--version") {
 | 
					 | 
				
			||||||
		let t = FormattedText::new(format!(
 | 
					 | 
				
			||||||
			"Daisy v{}\n", env!("CARGO_PKG_VERSION")
 | 
					 | 
				
			||||||
		));
 | 
					 | 
				
			||||||
		t.write(&context, &mut stdout)?;
 | 
					 | 
				
			||||||
		return Ok(());
 | 
					 | 
				
			||||||
	} else if args.iter().any(|s| s == "--debug") {
 | 
					 | 
				
			||||||
		let t = FormattedText::new(format!(
 | 
					 | 
				
			||||||
			concat!(
 | 
					 | 
				
			||||||
				"Daisy v{}\n",
 | 
					 | 
				
			||||||
				"Your terminal supports {} colors.\n"
 | 
					 | 
				
			||||||
			),
 | 
					 | 
				
			||||||
			env!("CARGO_PKG_VERSION"),
 | 
					 | 
				
			||||||
			term_colors
 | 
					 | 
				
			||||||
		));
 | 
					 | 
				
			||||||
		t.write(&context, &mut stdout)?;
 | 
					 | 
				
			||||||
		return Ok(());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	'outer: loop {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		pb.write_prompt(&mut context, &mut stdout)?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		let stdin = stdin();
 | 
					 | 
				
			||||||
		for c in stdin.keys() {
 | 
					 | 
				
			||||||
			if let Key::Char(q) = c.as_ref().unwrap() {
 | 
					 | 
				
			||||||
				match q {
 | 
					 | 
				
			||||||
					'\n' => {
 | 
					 | 
				
			||||||
						// Print again without cursor, in case we pressed enter
 | 
					 | 
				
			||||||
						// while inside a substitution
 | 
					 | 
				
			||||||
						pb.write_prompt_nocursor(&mut context, &mut stdout)?;
 | 
					 | 
				
			||||||
						let in_str = pb.enter();
 | 
					 | 
				
			||||||
						FormattedText::newline(&mut stdout)?;
 | 
					 | 
				
			||||||
						if in_str == "" { break; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
						if in_str.trim() == "quit" {
 | 
					 | 
				
			||||||
							break 'outer;
 | 
					 | 
				
			||||||
						} else {
 | 
					 | 
				
			||||||
							let r = crate::do_string(&mut context, &in_str);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							match r {
 | 
					 | 
				
			||||||
								Ok(t) | Err(t) => {
 | 
					 | 
				
			||||||
									t.write(&context, &mut stdout).unwrap();
 | 
					 | 
				
			||||||
								}
 | 
					 | 
				
			||||||
							}
 | 
					 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
						break;
 | 
					 | 
				
			||||||
					},
 | 
					 | 
				
			||||||
					_ => { pb.add_char(*q); }
 | 
					 | 
				
			||||||
				};
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				match c.unwrap() {
 | 
					 | 
				
			||||||
					Key::Backspace => { pb.backspace(); },
 | 
					 | 
				
			||||||
					Key::Delete => { pb.delete(); },
 | 
					 | 
				
			||||||
					Key::Left => { pb.cursor_left(); },
 | 
					 | 
				
			||||||
					Key::Right => { pb.cursor_right(); },
 | 
					 | 
				
			||||||
					Key::Up => { pb.hist_up(); },
 | 
					 | 
				
			||||||
					Key::Down => { pb.hist_down(); },
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					Key::Ctrl('d') |
 | 
					 | 
				
			||||||
					Key::Ctrl('c') => { break 'outer; },
 | 
					 | 
				
			||||||
					_ => {}
 | 
					 | 
				
			||||||
				};
 | 
					 | 
				
			||||||
			};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			pb.write_prompt(&mut context, &mut stdout)?;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	FormattedText::newline(&mut stdout)?;
 | 
					 | 
				
			||||||
	return Ok(());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -63,7 +63,7 @@ pub fn evaluate(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
					context.get_variable(&s)
 | 
										context.get_variable(&s)
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
				Expression::Operator(_, Operator::Function(_), _) => { Some(eval_function(g)?) },
 | 
									Expression::Operator(_, Operator::Function(_), _) => { eval_function(g)? },
 | 
				
			||||||
				Expression::Operator(_, _, _) => { eval_operator(context, g)? },
 | 
									Expression::Operator(_, _, _) => { eval_operator(context, g)? },
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@ fn to_radians(q: Quantity) -> Result<Quantity, ()> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub fn eval_function(g: &Expression) -> Result<Expression, (LineLocation, DaisyError)> {
 | 
					pub fn eval_function(g: &Expression) -> Result<Option<Expression>, (LineLocation, DaisyError)> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let Expression::Operator(loc, Operator::Function(f), args) = g else {unreachable!()};
 | 
						let Expression::Operator(loc, Operator::Function(f), args) = g else {unreachable!()};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -41,113 +41,112 @@ pub fn eval_function(g: &Expression) -> Result<Expression, (LineLocation, DaisyE
 | 
				
			|||||||
		))
 | 
							))
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let Expression::Quantity(l, q) = a else {panic!()};
 | 
						let Expression::Quantity(l, q) = a else { return Ok(None); };
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	match f {
 | 
						match f {
 | 
				
			||||||
		Function::NoUnit => { return Ok(Expression::Quantity(*loc + *l, q.without_unit())); }
 | 
							Function::NoUnit => { return Ok(Some(Expression::Quantity(*loc + *l, q.without_unit()))); }
 | 
				
			||||||
		Function::ToBase => { return Ok(Expression::Quantity(*loc + *l, q.convert_to_base())); }
 | 
							Function::ToBase => { return Ok(Some(Expression::Quantity(*loc + *l, q.convert_to_base()))); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Function::Abs => {
 | 
							Function::Abs => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.abs()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.abs())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Floor => {
 | 
							Function::Floor => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.floor()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.floor())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Ceil => {
 | 
							Function::Ceil => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.ceil()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.ceil())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Round => {
 | 
							Function::Round => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.round()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.round())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::NaturalLog => {
 | 
							Function::NaturalLog => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.ln()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.ln())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::TenLog => {
 | 
							Function::TenLog => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.log10()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.log10())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Function::Sin => {
 | 
							Function::Sin => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.sin()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.sin())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Cos => {
 | 
							Function::Cos => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.cos()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.cos())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Tan => {
 | 
							Function::Tan => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.tan()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.tan())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Csc => {
 | 
							Function::Csc => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.csc()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.csc())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Sec => {
 | 
							Function::Sec => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.sec()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.sec())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Cot => {
 | 
							Function::Cot => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.cot()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.cot())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Sinh => {
 | 
							Function::Sinh => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.sinh()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.sinh())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Cosh => {
 | 
							Function::Cosh => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.cosh()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.cosh())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Tanh => {
 | 
							Function::Tanh => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.tanh()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.tanh())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Csch => {
 | 
							Function::Csch => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.csch()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.csch())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Sech => {
 | 
							Function::Sech => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.sech()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.sech())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Coth => {
 | 
							Function::Coth => {
 | 
				
			||||||
			let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
								let Ok(q) = to_radians(q.clone()) else { return Err((*loc + *l, DaisyError::IncompatibleUnit)); };
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.coth()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.coth())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Asin => {
 | 
							Function::Asin => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.asin()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.asin())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Acos => {
 | 
							Function::Acos => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.acos()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.acos())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Atan => {
 | 
							Function::Atan => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.atan()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.atan())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Asinh => {
 | 
							Function::Asinh => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.asinh()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.asinh())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Acosh => {
 | 
							Function::Acosh => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.acosh()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.acosh())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::Atanh => {
 | 
							Function::Atanh => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, q.atanh()));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, q.atanh())));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -160,7 +159,7 @@ pub fn eval_function(g: &Expression) -> Result<Expression, (LineLocation, DaisyE
 | 
				
			|||||||
			let mut r = q.without_unit();
 | 
								let mut r = q.without_unit();
 | 
				
			||||||
			r += Quantity::new_rational(-273.15f64).unwrap();
 | 
								r += Quantity::new_rational(-273.15f64).unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, r));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, r)));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::ToFahrenheit => {
 | 
							Function::ToFahrenheit => {
 | 
				
			||||||
			let mut k = Quantity::new_rational(1f64).unwrap();
 | 
								let mut k = Quantity::new_rational(1f64).unwrap();
 | 
				
			||||||
@@ -172,7 +171,7 @@ pub fn eval_function(g: &Expression) -> Result<Expression, (LineLocation, DaisyE
 | 
				
			|||||||
			r += Quantity::new_rational(-459.67).unwrap();
 | 
								r += Quantity::new_rational(-459.67).unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, r));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, r)));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::FromCelsius => {
 | 
							Function::FromCelsius => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
@@ -181,7 +180,7 @@ pub fn eval_function(g: &Expression) -> Result<Expression, (LineLocation, DaisyE
 | 
				
			|||||||
			r += q.clone();
 | 
								r += q.clone();
 | 
				
			||||||
			r.insert_unit(FreeUnit::from_whole(WholeUnit::Kelvin), Scalar::new_rational(1f64).unwrap());
 | 
								r.insert_unit(FreeUnit::from_whole(WholeUnit::Kelvin), Scalar::new_rational(1f64).unwrap());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, r));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, r)));
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Function::FromFahrenheit => {
 | 
							Function::FromFahrenheit => {
 | 
				
			||||||
			if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
								if !q.unitless() { return Err((*loc + *l, DaisyError::IncompatibleUnit));}
 | 
				
			||||||
@@ -191,7 +190,7 @@ pub fn eval_function(g: &Expression) -> Result<Expression, (LineLocation, DaisyE
 | 
				
			|||||||
			r *= Quantity::new_rational_from_frac(5i64, 9i64).unwrap();
 | 
								r *= Quantity::new_rational_from_frac(5i64, 9i64).unwrap();
 | 
				
			||||||
			r.insert_unit(FreeUnit::from_whole(WholeUnit::Kelvin), Scalar::new_rational(1f64).unwrap());
 | 
								r.insert_unit(FreeUnit::from_whole(WholeUnit::Kelvin), Scalar::new_rational(1f64).unwrap());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return Ok(Expression::Quantity(*loc + *l, r));
 | 
								return Ok(Some(Expression::Quantity(*loc + *l, r)));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -19,6 +19,7 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			if args.len() != 1 {panic!()};
 | 
								if args.len() != 1 {panic!()};
 | 
				
			||||||
			let a = &args[0];
 | 
								let a = &args[0];
 | 
				
			||||||
 | 
								let mut args_ll = op_loc.clone();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if sh_vars.len() == 1 {
 | 
								if sh_vars.len() == 1 {
 | 
				
			||||||
				if let Expression::Tuple(l, v) = a {
 | 
									if let Expression::Tuple(l, v) = a {
 | 
				
			||||||
@@ -28,6 +29,7 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
					))
 | 
										))
 | 
				
			||||||
				};
 | 
									};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									args_ll += a.get_linelocation();
 | 
				
			||||||
				context.add_shadow(sh_vars[0].clone(), Some(a.clone()));
 | 
									context.add_shadow(sh_vars[0].clone(), Some(a.clone()));
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				let Expression::Tuple(l, v) = a else {
 | 
									let Expression::Tuple(l, v) = a else {
 | 
				
			||||||
@@ -46,18 +48,28 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				let mut i = 0;
 | 
									let mut i = 0;
 | 
				
			||||||
				while i < sh_vars.len() {
 | 
									while i < sh_vars.len() {
 | 
				
			||||||
 | 
										args_ll += v[i].get_linelocation();
 | 
				
			||||||
					context.add_shadow(sh_vars[i].clone(), Some(v[i].clone()));
 | 
										context.add_shadow(sh_vars[i].clone(), Some(v[i].clone()));
 | 
				
			||||||
					i += 1;
 | 
										i += 1;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			let r = evaluate(context, &exp)?;
 | 
								let r = evaluate(context, &exp);
 | 
				
			||||||
			context.clear_shadow();
 | 
								context.clear_shadow();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								match r {
 | 
				
			||||||
 | 
									Ok(mut r) => {
 | 
				
			||||||
 | 
										r.set_linelocation(&args_ll);
 | 
				
			||||||
					return Ok(Some(r));
 | 
										return Ok(Some(r));
 | 
				
			||||||
				},
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									Err( (_, err) ) => {
 | 
				
			||||||
 | 
										return Err((args_ll, err));
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Operator::Negative => {
 | 
							Operator::Negative => {
 | 
				
			||||||
			if args.len() != 1 { panic!() };
 | 
								if args.len() != 1 { panic!() };
 | 
				
			||||||
			let args = &args[0];
 | 
								let args = &args[0];
 | 
				
			||||||
@@ -75,12 +87,26 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
			if let Expression::Quantity(la, a) = a {
 | 
								if let Expression::Quantity(la, a) = a {
 | 
				
			||||||
				if let Expression::Quantity(lb, b) = b {
 | 
									if let Expression::Quantity(lb, b) = b {
 | 
				
			||||||
					if !a.unit.compatible_with(&b.unit) {
 | 
										if !a.unit.compatible_with(&b.unit) {
 | 
				
			||||||
 | 
											let a = a.convert_to_base().unit;
 | 
				
			||||||
 | 
											let b = b.convert_to_base().unit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											let a_s: String;
 | 
				
			||||||
 | 
											let b_s: String;
 | 
				
			||||||
 | 
											if a.unitless() {
 | 
				
			||||||
 | 
												a_s = String::from("scalar");
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												a_s = a.display(context);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											if b.unitless() {
 | 
				
			||||||
 | 
												b_s = String::from("scalar");
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												b_s = b.display(context);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						return Err((
 | 
											return Err((
 | 
				
			||||||
							*la + *lb + *op_loc,
 | 
												*la + *lb + *op_loc,
 | 
				
			||||||
							DaisyError::IncompatibleUnits(
 | 
												DaisyError::IncompatibleUnits(a_s, b_s)
 | 
				
			||||||
								a.convert_to_base().unit.display(context),
 | 
					 | 
				
			||||||
								b.convert_to_base().unit.display(context)
 | 
					 | 
				
			||||||
							)
 | 
					 | 
				
			||||||
						));
 | 
											));
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, a.clone() + b.clone())));
 | 
										return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, a.clone() + b.clone())));
 | 
				
			||||||
@@ -98,12 +124,24 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
			if let Expression::Quantity(la, a) = a {
 | 
								if let Expression::Quantity(la, a) = a {
 | 
				
			||||||
				if let Expression::Quantity(lb, b) = b {
 | 
									if let Expression::Quantity(lb, b) = b {
 | 
				
			||||||
					if !a.unit.compatible_with(&b.unit) {
 | 
										if !a.unit.compatible_with(&b.unit) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											let a_s: String;
 | 
				
			||||||
 | 
											let b_s: String;
 | 
				
			||||||
 | 
											if a.unitless() {
 | 
				
			||||||
 | 
												a_s = String::from("scalar");
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												a_s = a.display(context);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											if b.unitless() {
 | 
				
			||||||
 | 
												b_s = String::from("scalar");
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												b_s = b.display(context);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						return Err((
 | 
											return Err((
 | 
				
			||||||
							*la + *lb + *op_loc,
 | 
												*la + *lb + *op_loc,
 | 
				
			||||||
							DaisyError::IncompatibleUnits(
 | 
												DaisyError::IncompatibleUnits(a_s, b_s)
 | 
				
			||||||
								a.convert_to_base().unit.display(context),
 | 
					 | 
				
			||||||
								b.convert_to_base().unit.display(context)
 | 
					 | 
				
			||||||
							)
 | 
					 | 
				
			||||||
						));
 | 
											));
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, a.clone() - b.clone())));
 | 
										return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, a.clone() - b.clone())));
 | 
				
			||||||
@@ -138,7 +176,8 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			if let Expression::Quantity(la, a) = a {
 | 
								if let Expression::Quantity(la, a) = a {
 | 
				
			||||||
				if let Expression::Quantity(lb, b) = b {
 | 
									if let Expression::Quantity(lb, b) = b {
 | 
				
			||||||
					return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, a.clone() * b.clone())));
 | 
										let o = a.clone() * b.clone();
 | 
				
			||||||
 | 
										return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, o)));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -162,6 +201,11 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
					if va.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
 | 
										if va.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
 | 
				
			||||||
					if vb.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
 | 
										if vb.fract() != Quantity::new_rational(0f64).unwrap() { return Err((*la + *lb + *op_loc, DaisyError::BadMath)); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										let o = va.clone() % vb.clone();
 | 
				
			||||||
 | 
										if o.is_nan() {return Err((*la + *lb + *op_loc, DaisyError::BadMath));}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, va.clone() % vb.clone())));
 | 
										return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, va.clone() % vb.clone())));
 | 
				
			||||||
				} else { return Ok(None); }
 | 
									} else { return Ok(None); }
 | 
				
			||||||
			} else { return Ok(None); }
 | 
								} else { return Ok(None); }
 | 
				
			||||||
@@ -176,12 +220,26 @@ pub fn eval_operator(context: &mut Context, g: &Expression) -> Result<Option<Exp
 | 
				
			|||||||
				if let Expression::Quantity(lb, vb) = b {
 | 
									if let Expression::Quantity(lb, vb) = b {
 | 
				
			||||||
					let n = va.clone().convert_to(vb.clone());
 | 
										let n = va.clone().convert_to(vb.clone());
 | 
				
			||||||
					if n.is_none() {
 | 
										if n.is_none() {
 | 
				
			||||||
 | 
											let va = va.convert_to_base().unit;
 | 
				
			||||||
 | 
											let vb = vb.convert_to_base().unit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											let a_s: String;
 | 
				
			||||||
 | 
											let b_s: String;
 | 
				
			||||||
 | 
											if va.unitless() {
 | 
				
			||||||
 | 
												a_s = String::from("scalar");
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												a_s = a.display(context);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											if vb.unitless() {
 | 
				
			||||||
 | 
												b_s = String::from("scalar");
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												b_s = b.display(context);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						return Err((
 | 
											return Err((
 | 
				
			||||||
							*la + *lb + *op_loc,
 | 
												*la + *lb + *op_loc,
 | 
				
			||||||
							DaisyError::IncompatibleUnits(
 | 
												DaisyError::IncompatibleUnits(a_s, b_s)
 | 
				
			||||||
								va.convert_to_base().unit.display(context),
 | 
					 | 
				
			||||||
								vb.convert_to_base().unit.display(context)
 | 
					 | 
				
			||||||
							)
 | 
					 | 
				
			||||||
						));
 | 
											));
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, n.unwrap())));
 | 
										return Ok(Some(Expression::Quantity(*la + *lb + *op_loc, n.unwrap())));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,188 +0,0 @@
 | 
				
			|||||||
use std::io::Write;
 | 
					 | 
				
			||||||
use termion::raw::RawTerminal;
 | 
					 | 
				
			||||||
use termion::color;
 | 
					 | 
				
			||||||
use termion::style;
 | 
					 | 
				
			||||||
use termion::clear;
 | 
					 | 
				
			||||||
use termion::cursor;
 | 
					 | 
				
			||||||
use std::ops::Add;
 | 
					 | 
				
			||||||
use crate::context::Context;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#[derive(Debug)]
 | 
					 | 
				
			||||||
#[derive(Clone)]
 | 
					 | 
				
			||||||
pub struct FormattedText {
 | 
					 | 
				
			||||||
	text: String
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
impl ToString for FormattedText {
 | 
					 | 
				
			||||||
	fn to_string(&self) -> String { return self.text.clone(); }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fn format_map_none(c: char) -> Option<String> {
 | 
					 | 
				
			||||||
	Some(match c {
 | 
					 | 
				
			||||||
		'n'|'i'|'t'|'a'|
 | 
					 | 
				
			||||||
		'e'|'c'|'s'|'r'
 | 
					 | 
				
			||||||
		=> { "".to_string() },
 | 
					 | 
				
			||||||
		_ => { return None }
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fn format_map_ansi(c: char) -> Option<String> {
 | 
					 | 
				
			||||||
	Some(match c {
 | 
					 | 
				
			||||||
		'n' => { // Normal text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Reset), color::Bg(color::Reset))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'i' => { // Normal italic text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Reset), color::Bg(color::Reset))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		't' => { // Title text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::AnsiValue(6)), color::Bg(color::Reset))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'a' => { // Colored text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::AnsiValue(5)), color::Bg(color::Reset))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'e' => { // Error titles
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::AnsiValue(1)), color::Bg(color::Reset))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'c' => { // Console text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::AnsiValue(0)), color::Bg(color::AnsiValue(7)))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		's' => { // Repeat prompt (how => is styled)
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::AnsiValue(2)), color::Bg(color::Reset))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'r' => { // Result prompt (how = is styled)
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::AnsiValue(4)), color::Bg(color::Reset))
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		_ => { return None }
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fn format_map_full(c: char) -> Option<String> {
 | 
					 | 
				
			||||||
	Some(match c {
 | 
					 | 
				
			||||||
		'n' => { // Normal text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Reset), style::Reset)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'i' => { // Normal italic text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Reset), style::Italic)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		't' => { // Title text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Magenta), style::Bold)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'a' => { // Colored text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Magenta), style::Reset)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'e' => { // Error titles
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Red), style::Bold)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'c' => { // Console text
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::LightBlack), style::Italic)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		's' => { // Repeat prompt (how => is styled)
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Magenta), style::Bold)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		'r' => { // Result prompt (how = is styled)
 | 
					 | 
				
			||||||
			format!("{}{}", color::Fg(color::Green), style::Bold)
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		_ => { return None }
 | 
					 | 
				
			||||||
	})
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
impl FormattedText {
 | 
					 | 
				
			||||||
	pub fn newline(stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io::Error> {
 | 
					 | 
				
			||||||
		write!(
 | 
					 | 
				
			||||||
			stdout,
 | 
					 | 
				
			||||||
			"\r\n",
 | 
					 | 
				
			||||||
		)?;
 | 
					 | 
				
			||||||
		return Ok(());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
impl FormattedText {
 | 
					 | 
				
			||||||
	pub fn new(s: String) -> FormattedText {
 | 
					 | 
				
			||||||
		return FormattedText {
 | 
					 | 
				
			||||||
			text: s
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pub fn push(&mut self, s: &str) {
 | 
					 | 
				
			||||||
		self.text.push_str(s);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pub fn write(&self, context: &Context, stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io::Error> {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if self.text == "[clear]" {
 | 
					 | 
				
			||||||
			write!(
 | 
					 | 
				
			||||||
				stdout,
 | 
					 | 
				
			||||||
				"{}{}",
 | 
					 | 
				
			||||||
				clear::All,
 | 
					 | 
				
			||||||
				cursor::Goto(1, 1)
 | 
					 | 
				
			||||||
			)?;
 | 
					 | 
				
			||||||
			return Ok(());
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		let mut s = String::new();
 | 
					 | 
				
			||||||
		let mut chars = self.text.chars();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		while let Some(c) = chars.next() {
 | 
					 | 
				
			||||||
			match c {
 | 
					 | 
				
			||||||
				'[' => {
 | 
					 | 
				
			||||||
					let a = chars.next().unwrap();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					// Handle double [[ as escaped [
 | 
					 | 
				
			||||||
					if a == '[' { s.push('['); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					let b = chars.next().unwrap();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					match (a, b) {
 | 
					 | 
				
			||||||
						(c, ']') => { // Normal text
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							let q = match context.config.term_color_type {
 | 
					 | 
				
			||||||
								0 => format_map_none(c),
 | 
					 | 
				
			||||||
								1 => format_map_ansi(c),
 | 
					 | 
				
			||||||
								2 => format_map_full(c),
 | 
					 | 
				
			||||||
								_ => unreachable!("Invalid term_color_type")
 | 
					 | 
				
			||||||
							};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
							if q.is_some() {
 | 
					 | 
				
			||||||
								s.push_str(&q.unwrap());
 | 
					 | 
				
			||||||
							} else {
 | 
					 | 
				
			||||||
								s.push('[');
 | 
					 | 
				
			||||||
								s.push(a);
 | 
					 | 
				
			||||||
								s.push(b);
 | 
					 | 
				
			||||||
							}
 | 
					 | 
				
			||||||
						},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
						_ => {
 | 
					 | 
				
			||||||
							s.push('[');
 | 
					 | 
				
			||||||
							s.push(a);
 | 
					 | 
				
			||||||
							s.push(b);
 | 
					 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
				'\n' => { s.push_str("\r\n") },
 | 
					 | 
				
			||||||
				_ => s.push(c)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		write!(stdout, "{}", s)?;
 | 
					 | 
				
			||||||
		return Ok(());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
impl Add for FormattedText {
 | 
					 | 
				
			||||||
	type Output = Self;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	fn add(self, other: Self) -> Self::Output {
 | 
					 | 
				
			||||||
		return FormattedText::new(format!("{}{}", self.text, other.text));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										40
									
								
								src/formattedtext/formattedtext.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					use std::ops::Add;
 | 
				
			||||||
 | 
					use std::ops::AddAssign;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[derive(Debug)]
 | 
				
			||||||
 | 
					#[derive(Clone)]
 | 
				
			||||||
 | 
					pub struct FormattedText {
 | 
				
			||||||
 | 
						pub(super) text: String
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl ToString for FormattedText {
 | 
				
			||||||
 | 
						fn to_string(&self) -> String { return self.text.clone(); }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl FormattedText {
 | 
				
			||||||
 | 
						pub fn new(s: String) -> FormattedText {
 | 
				
			||||||
 | 
							return FormattedText {
 | 
				
			||||||
 | 
								text: s
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pub fn push(&mut self, s: &str) {
 | 
				
			||||||
 | 
							self.text.push_str(s);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl Add for FormattedText {
 | 
				
			||||||
 | 
						type Output = Self;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fn add(self, other: Self) -> Self::Output {
 | 
				
			||||||
 | 
							return FormattedText::new(format!("{}{}", self.text, other.text));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl AddAssign for FormattedText where {
 | 
				
			||||||
 | 
						fn add_assign(&mut self, other: Self) {
 | 
				
			||||||
 | 
							self.text.push_str(&other.text);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										12
									
								
								src/formattedtext/mod.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					mod formattedtext;
 | 
				
			||||||
 | 
					pub use formattedtext::FormattedText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Select write implementation by target system
 | 
				
			||||||
 | 
					cfg_if::cfg_if! {
 | 
				
			||||||
 | 
						if #[cfg(target_family = "unix")] {
 | 
				
			||||||
 | 
							mod unix_backend;
 | 
				
			||||||
 | 
						} else if #[cfg(target_arch = "wasm32")] {
 | 
				
			||||||
 | 
							mod wasm_backend;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										179
									
								
								src/formattedtext/unix_backend.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,179 @@
 | 
				
			|||||||
 | 
					use super::FormattedText;
 | 
				
			||||||
 | 
					use std::io::Write;
 | 
				
			||||||
 | 
					use crate::context::Context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use termion::raw::RawTerminal;
 | 
				
			||||||
 | 
					use termion::color;
 | 
				
			||||||
 | 
					use termion::style;
 | 
				
			||||||
 | 
					use termion::clear;
 | 
				
			||||||
 | 
					use termion::cursor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn format_map_ansi(s: &str) -> Option<String> {
 | 
				
			||||||
 | 
						Some(match s {
 | 
				
			||||||
 | 
							"n" => { // Normal text
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Reset), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"i" => { // Normal italic text
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Reset), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"t" => { // Title text (should be cyan)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::AnsiValue(6)), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"a" => { // Colored text (should be pink)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::AnsiValue(5)), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"e" => { // Error titles (should be red)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::AnsiValue(1)), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"c" => { // Console text (inverted black on white)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::AnsiValue(0)), color::Bg(color::AnsiValue(7)))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"p" => { // Input prompt (how ==> is styled) (should be blue)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::AnsiValue(4)), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"s" => { // Repeat prompt (how => is styled) (should be pink)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::AnsiValue(5)), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"r" => { // Result prompt (how = is styled) (should be green)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::AnsiValue(2)), color::Bg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							_ => { return None }
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn format_map_none(s: &str) -> Option<String> {
 | 
				
			||||||
 | 
						Some(match s {
 | 
				
			||||||
 | 
							"n"|"i"|"t"|"a"|
 | 
				
			||||||
 | 
							"e"|"c"|"s"|"r"|
 | 
				
			||||||
 | 
							"p"
 | 
				
			||||||
 | 
							=> { "".to_string() },
 | 
				
			||||||
 | 
							_ => { return None }
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// style::reset also resets color.
 | 
				
			||||||
 | 
					// Make sure color comes AFTER style reset.
 | 
				
			||||||
 | 
					fn format_map_full(s: &str) -> Option<String> {
 | 
				
			||||||
 | 
						Some(match s {
 | 
				
			||||||
 | 
							"n" => { // Normal text
 | 
				
			||||||
 | 
								format!("{}{}", style::Reset, color::Fg(color::Reset))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"i" => { // Normal italic text
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Reset), style::Italic)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"t" => { // Title text
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Magenta), style::Bold)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"a" => { // Colored text
 | 
				
			||||||
 | 
								format!("{}{}", style::Reset, color::Fg(color::Magenta))
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"e" => { // Error titles
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Red), style::Bold)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"c" => { // Console text
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::LightBlack), style::Italic)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"p" => { // Input prompt (how ==> is styled)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Blue), style::Bold)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"s" => { // Repeat prompt (how => is styled)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Magenta), style::Bold)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							"r" => { // Result prompt (how = is styled)
 | 
				
			||||||
 | 
								format!("{}{}", color::Fg(color::Green), style::Bold)
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							_ => { return None }
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl FormattedText {
 | 
				
			||||||
 | 
						pub fn newline(stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io::Error> {
 | 
				
			||||||
 | 
							write!(stdout, "\n")?;
 | 
				
			||||||
 | 
							return Ok(());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pub fn format_map(s: &str, context: &Context) -> Option<String> {
 | 
				
			||||||
 | 
							match context.config.term_color_type {
 | 
				
			||||||
 | 
								0 => format_map_none(s),
 | 
				
			||||||
 | 
								1 => format_map_ansi(s),
 | 
				
			||||||
 | 
								2 => format_map_full(s),
 | 
				
			||||||
 | 
								_ => unreachable!("Invalid term_color_type")
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pub fn write(&self, context: &Context, stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io::Error> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							let mut word = String::new();
 | 
				
			||||||
 | 
							let mut reading = false; // are we reading a word?
 | 
				
			||||||
 | 
							let mut chars = self.text.chars();
 | 
				
			||||||
 | 
							let mut out = String::new();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							while let Some(c) = chars.next() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								match c {
 | 
				
			||||||
 | 
									'[' => {
 | 
				
			||||||
 | 
										if reading {
 | 
				
			||||||
 | 
											// Discard old word, start reading again.
 | 
				
			||||||
 | 
											out.push_str(&word);
 | 
				
			||||||
 | 
											word.clear();
 | 
				
			||||||
 | 
										} 
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										// Start reading a new word
 | 
				
			||||||
 | 
										reading = true;
 | 
				
			||||||
 | 
										word.push(c);
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									']' => {
 | 
				
			||||||
 | 
										if !reading {
 | 
				
			||||||
 | 
											out.push(c);
 | 
				
			||||||
 | 
										} else {
 | 
				
			||||||
 | 
											word.push(c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											let f = Self::format_map(&word[1..word.len()-1], context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											if f.is_some() {
 | 
				
			||||||
 | 
												out.push_str(&f.unwrap());
 | 
				
			||||||
 | 
											} else if word == "[clear]" {
 | 
				
			||||||
 | 
												out.push_str(&format!(
 | 
				
			||||||
 | 
													"{}{}",
 | 
				
			||||||
 | 
													clear::All,
 | 
				
			||||||
 | 
													cursor::Goto(1, 1)
 | 
				
			||||||
 | 
												));
 | 
				
			||||||
 | 
											} else if word.starts_with("[cursorright") {
 | 
				
			||||||
 | 
												let n: u16 = word[12..word.len()-1].parse().unwrap();
 | 
				
			||||||
 | 
												out.push_str(&format!(
 | 
				
			||||||
 | 
													"{}",
 | 
				
			||||||
 | 
													cursor::Right(n),
 | 
				
			||||||
 | 
												));
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												out.push_str(&word);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											reading = false;
 | 
				
			||||||
 | 
											word.clear();
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									'\n' => {
 | 
				
			||||||
 | 
										if reading { word.push_str("\r\n"); }
 | 
				
			||||||
 | 
										else { out.push_str("\r\n"); }
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									_ => {
 | 
				
			||||||
 | 
										if reading { word.push(c); }
 | 
				
			||||||
 | 
										else { out.push(c); }
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							write!(stdout, "\r{}", out)?;
 | 
				
			||||||
 | 
							stdout.flush()?;
 | 
				
			||||||
 | 
							return Ok(());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										80
									
								
								src/formattedtext/wasm_backend.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,80 @@
 | 
				
			|||||||
 | 
					use super::FormattedText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn format_map(s: &str) -> Option<String> {
 | 
				
			||||||
 | 
						Some(match s {
 | 
				
			||||||
 | 
							"n" => {"\x1B[0m"},
 | 
				
			||||||
 | 
							"i" => {"\x1B[3m"},
 | 
				
			||||||
 | 
							"t" => {"\x1B[1;35m"},
 | 
				
			||||||
 | 
							"a" => {"\x1B[0;35m"},
 | 
				
			||||||
 | 
							"e" => {"\x1B[1;31m"},
 | 
				
			||||||
 | 
							"c" => {"\x1B[3;90m"},
 | 
				
			||||||
 | 
							"p" => {"\x1B[1;34m"},
 | 
				
			||||||
 | 
							"s" => {"\x1B[1;35m"},
 | 
				
			||||||
 | 
							"r" => {"\x1B[1;32m"},
 | 
				
			||||||
 | 
							_ => { return None }
 | 
				
			||||||
 | 
						}.to_string())
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl FormattedText {
 | 
				
			||||||
 | 
						pub fn write(&self) -> String {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							let mut word = String::new();
 | 
				
			||||||
 | 
							let mut reading = false; // are we reading a word?
 | 
				
			||||||
 | 
							let mut chars = self.text.chars();
 | 
				
			||||||
 | 
							let mut out = String::new();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							while let Some(c) = chars.next() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								match c {
 | 
				
			||||||
 | 
									'[' => {
 | 
				
			||||||
 | 
										if reading {
 | 
				
			||||||
 | 
											// Discard old word, start reading again.
 | 
				
			||||||
 | 
											out.push_str(&word);
 | 
				
			||||||
 | 
											word.clear();
 | 
				
			||||||
 | 
										} 
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										// Start reading a new word
 | 
				
			||||||
 | 
										reading = true;
 | 
				
			||||||
 | 
										word.push(c);
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									']' => {
 | 
				
			||||||
 | 
										if !reading {
 | 
				
			||||||
 | 
											out.push(c);
 | 
				
			||||||
 | 
										} else {
 | 
				
			||||||
 | 
											word.push(c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											let f = format_map(&word[1..word.len()-1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											if f.is_some() {
 | 
				
			||||||
 | 
												out.push_str(&f.unwrap());
 | 
				
			||||||
 | 
											} else if word == "[clear]" {
 | 
				
			||||||
 | 
												out.push_str(&format!("\x1B[2J\x1B[H"));
 | 
				
			||||||
 | 
											} else if word.starts_with("[cursorright") {
 | 
				
			||||||
 | 
												let n: u16 = word[12..word.len()-1].parse().unwrap();
 | 
				
			||||||
 | 
												out.push_str(&format!("\x1B[{n}C"));
 | 
				
			||||||
 | 
											} else {
 | 
				
			||||||
 | 
												out.push_str(&word);
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
											reading = false;
 | 
				
			||||||
 | 
											word.clear();
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									'\n' => {
 | 
				
			||||||
 | 
										if reading { word.push_str("\r\n"); }
 | 
				
			||||||
 | 
										else { out.push_str("\r\n"); }
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									_ => {
 | 
				
			||||||
 | 
										if reading { word.push(c); }
 | 
				
			||||||
 | 
										else { out.push(c); }
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return out;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										375
									
								
								src/lib.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,375 @@
 | 
				
			|||||||
 | 
					pub mod parser;
 | 
				
			||||||
 | 
					pub mod command;
 | 
				
			||||||
 | 
					pub mod quantity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use crate::parser::substitute;
 | 
				
			||||||
 | 
					use crate::parser::LineLocation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mod context;
 | 
				
			||||||
 | 
					mod formattedtext;
 | 
				
			||||||
 | 
					mod errors;
 | 
				
			||||||
 | 
					mod evaluate;
 | 
				
			||||||
 | 
					mod promptbuffer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub use crate::formattedtext::FormattedText;
 | 
				
			||||||
 | 
					pub use crate::context::Context;
 | 
				
			||||||
 | 
					pub use crate::errors::DaisyError;
 | 
				
			||||||
 | 
					pub use crate::evaluate::evaluate;
 | 
				
			||||||
 | 
					pub use crate::promptbuffer::PromptBuffer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cfg_if::cfg_if! {
 | 
				
			||||||
 | 
						if #[cfg(target_arch = "wasm32")] {
 | 
				
			||||||
 | 
							use wasm_bindgen::prelude::*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#[derive(Debug)]
 | 
				
			||||||
 | 
							pub struct State {
 | 
				
			||||||
 | 
								pub context: Context,
 | 
				
			||||||
 | 
								pub promptbuffer: PromptBuffer
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#[wasm_bindgen]
 | 
				
			||||||
 | 
							pub extern fn daisy_init() -> *mut State {
 | 
				
			||||||
 | 
								Box::into_raw(Box::new(State {
 | 
				
			||||||
 | 
									context: Context::new(),
 | 
				
			||||||
 | 
									promptbuffer: PromptBuffer::new(64)
 | 
				
			||||||
 | 
								}))
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#[wasm_bindgen]
 | 
				
			||||||
 | 
							pub extern fn daisy_free(state: *mut State) {
 | 
				
			||||||
 | 
								unsafe { drop(Box::from_raw(state)) };
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#[wasm_bindgen]
 | 
				
			||||||
 | 
							pub fn daisy_prompt(state: *mut State) -> String {
 | 
				
			||||||
 | 
								let t = unsafe { (*state).promptbuffer.write_prompt(&mut (*state).context) };
 | 
				
			||||||
 | 
								return t.write();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							#[wasm_bindgen]
 | 
				
			||||||
 | 
							pub fn daisy_char(state: *mut State, s: String) -> String {
 | 
				
			||||||
 | 
								let mut out = FormattedText::new("".to_string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								match &s[..] {
 | 
				
			||||||
 | 
									"\r" => {
 | 
				
			||||||
 | 
										// Print again without cursor, in case we pressed enter
 | 
				
			||||||
 | 
										// while inside a substitution
 | 
				
			||||||
 | 
										let t = unsafe { (*state).promptbuffer.write_prompt_nocursor(&mut (*state).context) };
 | 
				
			||||||
 | 
										out += t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										let in_str = unsafe { (*state).promptbuffer.enter() };
 | 
				
			||||||
 | 
										out += FormattedText::new("\n".to_string());
 | 
				
			||||||
 | 
										if in_str == "" {
 | 
				
			||||||
 | 
											return format!("\r\n{}", daisy_prompt(state));
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										let r = crate::do_string( unsafe { &mut (*state).context }, &in_str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										match r {
 | 
				
			||||||
 | 
											Ok(t) | Err(t) => {
 | 
				
			||||||
 | 
												out += t;
 | 
				
			||||||
 | 
											}
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									"\x7F" => { unsafe { (*state).promptbuffer.backspace(); } },
 | 
				
			||||||
 | 
									"\x1B[3~" => { unsafe { (*state).promptbuffer.delete(); } },
 | 
				
			||||||
 | 
									"\x1B[D" => { unsafe { (*state).promptbuffer.cursor_left(); } },
 | 
				
			||||||
 | 
									"\x1B[C" => { unsafe { (*state).promptbuffer.cursor_right(); } },
 | 
				
			||||||
 | 
									"\x1B[A" => { unsafe { (*state).promptbuffer.hist_up(); } },
 | 
				
			||||||
 | 
									"\x1B[B" => { unsafe { (*state).promptbuffer.hist_down(); } },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									//'\x04' | '\x03'
 | 
				
			||||||
 | 
									//=> { break 'outer; },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// 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) };
 | 
				
			||||||
 | 
								return (out + t).write();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[inline(always)]
 | 
				
			||||||
 | 
					pub fn do_string(
 | 
				
			||||||
 | 
						context: &mut Context,
 | 
				
			||||||
 | 
						s: &String
 | 
				
			||||||
 | 
					) -> Result<FormattedText, FormattedText> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let r: (LineLocation, DaisyError);
 | 
				
			||||||
 | 
						if command::is_command(s) {
 | 
				
			||||||
 | 
							return Ok(command::do_command(context, s));
 | 
				
			||||||
 | 
						} else if s.contains("=") {
 | 
				
			||||||
 | 
							let x = do_assignment(context, s);
 | 
				
			||||||
 | 
							match x {
 | 
				
			||||||
 | 
								Ok(t) => { return Ok(t) },
 | 
				
			||||||
 | 
								Err(t) => { r = t }
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							let x = do_expression(context, s);
 | 
				
			||||||
 | 
							match x {
 | 
				
			||||||
 | 
								Ok((t, e)) => { context.push_hist(e); return Ok(t) },
 | 
				
			||||||
 | 
								Err(t) => { r = t }
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let (l, e) = r;
 | 
				
			||||||
 | 
						let mut t = FormattedText::new("".to_string());
 | 
				
			||||||
 | 
						if l.zero() {
 | 
				
			||||||
 | 
							t.push(&format!(
 | 
				
			||||||
 | 
								"\n  {}\n\n",
 | 
				
			||||||
 | 
								e.text().to_string(),
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							t.push(&format!(
 | 
				
			||||||
 | 
								concat!(
 | 
				
			||||||
 | 
									"{}[e]{}[n]\n",
 | 
				
			||||||
 | 
									"  {}\n\n"
 | 
				
			||||||
 | 
								),
 | 
				
			||||||
 | 
								" ".repeat(l.pos + 4),
 | 
				
			||||||
 | 
								"^".repeat(l.len),
 | 
				
			||||||
 | 
								e.text().to_string(),
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Err(t);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Handle a simple evaluation string.
 | 
				
			||||||
 | 
					// Returns a FormattedText with output that should be printed.
 | 
				
			||||||
 | 
					#[inline(always)]
 | 
				
			||||||
 | 
					fn do_expression(
 | 
				
			||||||
 | 
						context: &mut Context,
 | 
				
			||||||
 | 
						s: &String
 | 
				
			||||||
 | 
					) -> Result<(FormattedText, parser::Expression), (LineLocation, DaisyError)> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let mut output = FormattedText::new("".to_string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let g = parser::parse(context, &s)?;
 | 
				
			||||||
 | 
						let g_evaluated = evaluate::evaluate(context, &g)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Display parsed string
 | 
				
			||||||
 | 
						output.push(&format!(
 | 
				
			||||||
 | 
							" [s]=>[n] {}\n\n",
 | 
				
			||||||
 | 
							g.display(context)
 | 
				
			||||||
 | 
						));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Display result
 | 
				
			||||||
 | 
						output.push(&format!(
 | 
				
			||||||
 | 
							"  [r]=[n] {}\n\n",
 | 
				
			||||||
 | 
							g_evaluated.display_outer(context),
 | 
				
			||||||
 | 
						));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Ok((output, g_evaluated));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Handle a variable or function definition string.
 | 
				
			||||||
 | 
					// Returns a FormattedText with output that should be printed.
 | 
				
			||||||
 | 
					#[inline(always)]
 | 
				
			||||||
 | 
					fn do_assignment(
 | 
				
			||||||
 | 
						context: &mut Context,
 | 
				
			||||||
 | 
						s: &String
 | 
				
			||||||
 | 
					) -> Result<FormattedText, (LineLocation, DaisyError)> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let mut output = FormattedText::new("".to_string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let parts = s.split("=").collect::<Vec<&str>>();
 | 
				
			||||||
 | 
						if parts.len() != 2 {
 | 
				
			||||||
 | 
							return Err((
 | 
				
			||||||
 | 
								LineLocation::new_zero(),
 | 
				
			||||||
 | 
								DaisyError::Syntax
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Index of first non-whitespace character in left
 | 
				
			||||||
 | 
						// (relative to whole prompt)
 | 
				
			||||||
 | 
						let starting_left = parts[0]
 | 
				
			||||||
 | 
							.char_indices()
 | 
				
			||||||
 | 
							.find(|(_, ch)| !(ch.is_whitespace() && *ch != '\n'))
 | 
				
			||||||
 | 
							.map(|(i, _)| i)
 | 
				
			||||||
 | 
							.unwrap_or_else(|| parts[0].len());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Index of first non-whitespace character in right
 | 
				
			||||||
 | 
						// (relative to whole prompt)
 | 
				
			||||||
 | 
						// +1 accounts for equals sign
 | 
				
			||||||
 | 
						let starting_right = parts[0].chars().count() + 1 +
 | 
				
			||||||
 | 
							parts[1]
 | 
				
			||||||
 | 
								.char_indices()
 | 
				
			||||||
 | 
								.find(|(_, ch)| !(ch.is_whitespace() && *ch != '\n'))
 | 
				
			||||||
 | 
								.map(|(i, _)| i)
 | 
				
			||||||
 | 
								.unwrap_or_else(|| parts[0].len());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let left = substitute(context, &parts[0].trim().to_string());
 | 
				
			||||||
 | 
						let right = substitute(context, &parts[1].trim().to_string());
 | 
				
			||||||
 | 
						let is_function = left.contains("(");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// The order of methods below is a bit odd.
 | 
				
			||||||
 | 
						// This is intentional, since we want to check a definition's
 | 
				
			||||||
 | 
						// variable name before even attempting to parse its content.
 | 
				
			||||||
 | 
						if is_function {
 | 
				
			||||||
 | 
							let mut mode = 0;
 | 
				
			||||||
 | 
							let mut name = String::new();
 | 
				
			||||||
 | 
							let mut args = String::new();
 | 
				
			||||||
 | 
							for c in left.chars() {
 | 
				
			||||||
 | 
								match mode {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// Mode 0: reading function name
 | 
				
			||||||
 | 
									0 => {
 | 
				
			||||||
 | 
										if c == '(' {
 | 
				
			||||||
 | 
											mode = 1; continue;
 | 
				
			||||||
 | 
										} else { name.push(c); }
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// Mode 1: reading arguments
 | 
				
			||||||
 | 
									1 => {
 | 
				
			||||||
 | 
										if c == ')' {
 | 
				
			||||||
 | 
											mode = 2; continue;
 | 
				
			||||||
 | 
										} else { args.push(c); }
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// Mode 2: we should be done by now.
 | 
				
			||||||
 | 
									// That close paren should've been the last character.
 | 
				
			||||||
 | 
									2 => {
 | 
				
			||||||
 | 
										return Err((
 | 
				
			||||||
 | 
											LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
				
			||||||
 | 
											DaisyError::Syntax
 | 
				
			||||||
 | 
										));
 | 
				
			||||||
 | 
									},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									_ => unreachable!()
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							let args = args
 | 
				
			||||||
 | 
								.split(",").collect::<Vec<&str>>()
 | 
				
			||||||
 | 
								.iter().map(|x| x.trim().to_string()).collect::<Vec<String>>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if name.len() == 0 {
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
				
			||||||
 | 
									DaisyError::Syntax
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if !context.valid_function(&name) {
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
				
			||||||
 | 
									DaisyError::BadFunction
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if args.iter().find(|x| &x[..] == "").is_some() {
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
				
			||||||
 | 
									DaisyError::Syntax
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for a in &args {
 | 
				
			||||||
 | 
								if !context.valid_varible(a) {
 | 
				
			||||||
 | 
									return Err((
 | 
				
			||||||
 | 
										LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
				
			||||||
 | 
										DaisyError::BadVariable
 | 
				
			||||||
 | 
									));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Parse right hand side
 | 
				
			||||||
 | 
							let g = parser::parse(context, &right);
 | 
				
			||||||
 | 
							let Ok(g) = g else {
 | 
				
			||||||
 | 
								let Err((l, e)) = g else { unreachable!() };
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
				
			||||||
 | 
									e
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Display parsed string
 | 
				
			||||||
 | 
							output.push(&format!(
 | 
				
			||||||
 | 
								" [s]=>[n] {left} = {}\n\n",
 | 
				
			||||||
 | 
								g.display(context)
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Evaluate expression with shadow variables
 | 
				
			||||||
 | 
							for a in &args { context.add_shadow(a.to_string(), None);}
 | 
				
			||||||
 | 
							let g_evaluated = evaluate::evaluate(context, &g);
 | 
				
			||||||
 | 
							context.clear_shadow();
 | 
				
			||||||
 | 
							let Ok(_g_evaluated) = g_evaluated else {
 | 
				
			||||||
 | 
								let Err((l, e)) = g_evaluated else { unreachable!() };
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
				
			||||||
 | 
									e
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// We could push g_evaluated instead, but an un-evaluated string
 | 
				
			||||||
 | 
							// makes the 'vars' command prettier.
 | 
				
			||||||
 | 
							//
 | 
				
			||||||
 | 
							// We still need to evaluate g above, though, to make sure it works.
 | 
				
			||||||
 | 
							context.push_function(name, args, g).unwrap();
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if !context.valid_varible(&left) {
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
				
			||||||
 | 
									DaisyError::BadVariable
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Parse right hand side
 | 
				
			||||||
 | 
							let g = parser::parse(context, &right);
 | 
				
			||||||
 | 
							let Ok(g) = g else {
 | 
				
			||||||
 | 
								let Err((l, e)) = g else { unreachable!() };
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
				
			||||||
 | 
									e
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Display parsed string
 | 
				
			||||||
 | 
							output.push(&format!(
 | 
				
			||||||
 | 
								" [t]=>[n] {left} = {}\n\n",
 | 
				
			||||||
 | 
								g.display(context)
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Evaluate expression
 | 
				
			||||||
 | 
							let g_evaluated = evaluate::evaluate(context, &g);
 | 
				
			||||||
 | 
							let Ok(g_evaluated) = g_evaluated else {
 | 
				
			||||||
 | 
								let Err((l, e)) = g_evaluated else { unreachable!() };
 | 
				
			||||||
 | 
								return Err((
 | 
				
			||||||
 | 
									LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
				
			||||||
 | 
									e
 | 
				
			||||||
 | 
								));
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							context.push_variable(left.to_string(), g_evaluated).unwrap();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return Ok(output);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										372
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						@@ -1,289 +1,151 @@
 | 
				
			|||||||
pub mod parser;
 | 
					use std::io::stdout;
 | 
				
			||||||
pub mod command;
 | 
					use std::io::stdin;
 | 
				
			||||||
pub mod quantity;
 | 
					use std::env;
 | 
				
			||||||
pub mod evaluate;
 | 
					 | 
				
			||||||
pub mod context;
 | 
					 | 
				
			||||||
pub mod errors;
 | 
					 | 
				
			||||||
pub mod formattedtext;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
use crate::parser::substitute;
 | 
					use termion::{
 | 
				
			||||||
use crate::errors::DaisyError;
 | 
						event::Key,
 | 
				
			||||||
use crate::formattedtext::FormattedText;
 | 
						input::TermRead,
 | 
				
			||||||
use crate::context::Context;
 | 
						raw::IntoRawMode,
 | 
				
			||||||
use crate::parser::LineLocation;
 | 
						color::DetectColors
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use daisycalc::PromptBuffer;
 | 
				
			||||||
// Run main script for target system
 | 
					use daisycalc::command;
 | 
				
			||||||
mod entrypoint;
 | 
					use daisycalc::Context;
 | 
				
			||||||
use crate::entrypoint::main_e;
 | 
					use daisycalc::FormattedText;
 | 
				
			||||||
 | 
					use daisycalc::do_string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[cfg(test)]
 | 
					#[cfg(test)]
 | 
				
			||||||
mod tests;
 | 
					mod tests;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() -> Result<(), std::io::Error> {
 | 
					
 | 
				
			||||||
	return main_e();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[inline(always)]
 | 
					#[inline(always)]
 | 
				
			||||||
pub fn do_string(
 | 
					pub fn main() -> Result<(), std::io::Error> {
 | 
				
			||||||
	context: &mut Context,
 | 
						let mut stdout = stdout().into_raw_mode().unwrap();
 | 
				
			||||||
	s: &String
 | 
						let mut pb: PromptBuffer = PromptBuffer::new(64);
 | 
				
			||||||
) -> Result<FormattedText, FormattedText> {
 | 
						let mut context = Context::new();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let r: (LineLocation, DaisyError);
 | 
						// Detect color compatibilty
 | 
				
			||||||
	if command::is_command(s) {
 | 
						// Currently unused, this is slow.
 | 
				
			||||||
		return Ok(command::do_command(context, s));
 | 
						/*
 | 
				
			||||||
	} else if s.contains("=") {
 | 
						let term_colors = stdout.available_colors().unwrap_or(0);
 | 
				
			||||||
		let x = do_assignment(context, s);
 | 
						if term_colors >= 256 {
 | 
				
			||||||
		match x {
 | 
							context.config.term_color_type = 2;
 | 
				
			||||||
			Ok(t) => { return Ok(t) },
 | 
						} else if term_colors >= 8 {
 | 
				
			||||||
			Err(t) => { r = t }
 | 
							context.config.term_color_type = 1;
 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		let x = do_expression(context, s);
 | 
							context.config.term_color_type = 0;
 | 
				
			||||||
		match x {
 | 
					 | 
				
			||||||
			Ok((t, e)) => { context.push_hist(e); return Ok(t) },
 | 
					 | 
				
			||||||
			Err(t) => { r = t }
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let (l, e) = r;
 | 
					
 | 
				
			||||||
	let mut t = FormattedText::new("".to_string());
 | 
						// Handle command-line arguments
 | 
				
			||||||
	if l.zero() {
 | 
						let args: Vec<String> = env::args().collect();
 | 
				
			||||||
		t.push(&format!(
 | 
						if args.iter().any(|s| s == "--help") {
 | 
				
			||||||
			"\n  {}\n\n",
 | 
							let t = command::do_command(&mut context, &String::from("help"));
 | 
				
			||||||
			e.text().to_string(),
 | 
							t.write(&context, &mut stdout)?;
 | 
				
			||||||
 | 
							let t = command::do_command(&mut context, &String::from("flags"));
 | 
				
			||||||
 | 
							t.write(&context, &mut stdout)?;
 | 
				
			||||||
 | 
							return Ok(());
 | 
				
			||||||
 | 
						} else if args.iter().any(|s| s == "--version") {
 | 
				
			||||||
 | 
							let t = FormattedText::new(format!(
 | 
				
			||||||
 | 
								"Daisy v{}\n", env!("CARGO_PKG_VERSION")
 | 
				
			||||||
		));
 | 
							));
 | 
				
			||||||
	} else {
 | 
							t.write(&context, &mut stdout)?;
 | 
				
			||||||
		t.push(&format!(
 | 
							return Ok(());
 | 
				
			||||||
 | 
						} else if args.iter().any(|s| s == "--info") {
 | 
				
			||||||
 | 
							let t = FormattedText::new(format!(
 | 
				
			||||||
			concat!(
 | 
								concat!(
 | 
				
			||||||
				"{}[e]{}[n]\n",
 | 
									"Daisy v{}\n",
 | 
				
			||||||
				"  {}\n\n"
 | 
									"Your terminal supports {} colors.\n"
 | 
				
			||||||
			),
 | 
								),
 | 
				
			||||||
			" ".repeat(l.pos + 4),
 | 
								env!("CARGO_PKG_VERSION"),
 | 
				
			||||||
			"^".repeat(l.len),
 | 
								stdout.available_colors().unwrap_or(0)
 | 
				
			||||||
			e.text().to_string(),
 | 
					 | 
				
			||||||
		));
 | 
							));
 | 
				
			||||||
 | 
							t.write(&context, &mut stdout)?;
 | 
				
			||||||
 | 
							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;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return Err(t);
 | 
						context.config.check();
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Handle a simple evaluation string.
 | 
					 | 
				
			||||||
// Returns a FormattedText with output that should be printed.
 | 
					 | 
				
			||||||
#[inline(always)]
 | 
					 | 
				
			||||||
fn do_expression(
 | 
					 | 
				
			||||||
	context: &mut Context,
 | 
					 | 
				
			||||||
	s: &String
 | 
					 | 
				
			||||||
) -> Result<(FormattedText, parser::Expression), (LineLocation, DaisyError)> {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let mut output = FormattedText::new("".to_string());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let g = parser::parse(context, &s)?;
 | 
					 | 
				
			||||||
	let g_evaluated = evaluate::evaluate(context, &g)?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Display parsed string
 | 
					 | 
				
			||||||
	output.push(&format!(
 | 
					 | 
				
			||||||
		" [s]=>[n] {}\n\n",
 | 
					 | 
				
			||||||
		g.display(context)
 | 
					 | 
				
			||||||
	));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Display result
 | 
					 | 
				
			||||||
	output.push(&format!(
 | 
					 | 
				
			||||||
		"  [r]=[n] {}\n\n",
 | 
					 | 
				
			||||||
		g_evaluated.display_outer(context),
 | 
					 | 
				
			||||||
	));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return Ok((output, g_evaluated));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Handle a variable or function definition string.
 | 
						'outer: loop {
 | 
				
			||||||
// Returns a FormattedText with output that should be printed.
 | 
					 | 
				
			||||||
#[inline(always)]
 | 
					 | 
				
			||||||
fn do_assignment(
 | 
					 | 
				
			||||||
	context: &mut Context,
 | 
					 | 
				
			||||||
	s: &String
 | 
					 | 
				
			||||||
) -> Result<FormattedText, (LineLocation, DaisyError)> {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let mut output = FormattedText::new("".to_string());
 | 
							let t = pb.write_prompt(&mut context);
 | 
				
			||||||
 | 
							t.write(&context, &mut stdout)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let parts = s.split("=").collect::<Vec<&str>>();
 | 
							let stdin = stdin();
 | 
				
			||||||
	if parts.len() != 2 {
 | 
							for c in stdin.keys() {
 | 
				
			||||||
		return Err((
 | 
								if let Key::Char(q) = c.as_ref().unwrap() {
 | 
				
			||||||
			LineLocation::new_zero(),
 | 
									match q {
 | 
				
			||||||
			DaisyError::Syntax
 | 
										'\n' => {
 | 
				
			||||||
		));
 | 
											// Print again without cursor, in case we pressed enter
 | 
				
			||||||
	}
 | 
											// while inside a substitution
 | 
				
			||||||
 | 
											let t = pb.write_prompt_nocursor(&mut context);
 | 
				
			||||||
	// Index of first non-whitespace character in left
 | 
											t.write(&context, &mut stdout)?;
 | 
				
			||||||
	// (relative to whole prompt)
 | 
					 | 
				
			||||||
	let starting_left = parts[0]
 | 
					 | 
				
			||||||
		.char_indices()
 | 
					 | 
				
			||||||
		.find(|(_, ch)| !(ch.is_whitespace() && *ch != '\n'))
 | 
					 | 
				
			||||||
		.map(|(i, _)| i)
 | 
					 | 
				
			||||||
		.unwrap_or_else(|| parts[0].len());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Index of first non-whitespace character in right
 | 
					 | 
				
			||||||
	// (relative to whole prompt)
 | 
					 | 
				
			||||||
	// +1 accounts for equals sign
 | 
					 | 
				
			||||||
	let starting_right = parts[0].chars().count() + 1 +
 | 
					 | 
				
			||||||
		parts[1]
 | 
					 | 
				
			||||||
			.char_indices()
 | 
					 | 
				
			||||||
			.find(|(_, ch)| !(ch.is_whitespace() && *ch != '\n'))
 | 
					 | 
				
			||||||
			.map(|(i, _)| i)
 | 
					 | 
				
			||||||
			.unwrap_or_else(|| parts[0].len());
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let left = substitute(context, &parts[0].trim().to_string());
 | 
											let in_str = pb.enter();
 | 
				
			||||||
	let right = substitute(context, &parts[1].trim().to_string());
 | 
											FormattedText::newline(&mut stdout)?;
 | 
				
			||||||
	let is_function = left.contains("(");
 | 
											if in_str == "" { break; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// The order of methods below is a bit odd.
 | 
											if in_str.trim() == "quit" {
 | 
				
			||||||
	// This is intentional, since we want to check a definition's
 | 
												break 'outer;
 | 
				
			||||||
	// variable name before even attempting to parse its content.
 | 
					 | 
				
			||||||
	if is_function {
 | 
					 | 
				
			||||||
		let mut mode = 0;
 | 
					 | 
				
			||||||
		let mut name = String::new();
 | 
					 | 
				
			||||||
		let mut args = String::new();
 | 
					 | 
				
			||||||
		for c in left.chars() {
 | 
					 | 
				
			||||||
			match mode {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				// Mode 0: reading function name
 | 
					 | 
				
			||||||
				0 => {
 | 
					 | 
				
			||||||
					if c == '(' {
 | 
					 | 
				
			||||||
						mode = 1; continue;
 | 
					 | 
				
			||||||
					} else { name.push(c); }
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				// Mode 1: reading arguments
 | 
					 | 
				
			||||||
				1 => {
 | 
					 | 
				
			||||||
					if c == ')' {
 | 
					 | 
				
			||||||
						mode = 2; continue;
 | 
					 | 
				
			||||||
					} else { args.push(c); }
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				// Mode 2: we should be done by now.
 | 
					 | 
				
			||||||
				// That close paren should've been the last character.
 | 
					 | 
				
			||||||
				2 => {
 | 
					 | 
				
			||||||
					return Err((
 | 
					 | 
				
			||||||
						LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
					 | 
				
			||||||
						DaisyError::Syntax
 | 
					 | 
				
			||||||
					));
 | 
					 | 
				
			||||||
				},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				_ => unreachable!()
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		let args = args
 | 
					 | 
				
			||||||
			.split(",").collect::<Vec<&str>>()
 | 
					 | 
				
			||||||
			.iter().map(|x| x.trim().to_string()).collect::<Vec<String>>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if name.len() == 0 {
 | 
					 | 
				
			||||||
			return Err((
 | 
					 | 
				
			||||||
				LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
					 | 
				
			||||||
				DaisyError::Syntax
 | 
					 | 
				
			||||||
			));
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if !context.valid_function(&name) {
 | 
					 | 
				
			||||||
			return Err((
 | 
					 | 
				
			||||||
				LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
					 | 
				
			||||||
				DaisyError::BadFunction
 | 
					 | 
				
			||||||
			));
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if args.iter().find(|x| &x[..] == "").is_some() {
 | 
					 | 
				
			||||||
			return Err((
 | 
					 | 
				
			||||||
				LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
					 | 
				
			||||||
				DaisyError::Syntax
 | 
					 | 
				
			||||||
			));
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		for a in &args {
 | 
					 | 
				
			||||||
			if !context.valid_varible(a) {
 | 
					 | 
				
			||||||
				return Err((
 | 
					 | 
				
			||||||
					LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
					 | 
				
			||||||
					DaisyError::BadVariable
 | 
					 | 
				
			||||||
				));
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Parse right hand side
 | 
					 | 
				
			||||||
		let g = parser::parse(context, &right);
 | 
					 | 
				
			||||||
		let Ok(g) = g else {
 | 
					 | 
				
			||||||
			let Err((l, e)) = g else { unreachable!() };
 | 
					 | 
				
			||||||
			return Err((
 | 
					 | 
				
			||||||
				LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
					 | 
				
			||||||
				e
 | 
					 | 
				
			||||||
			));
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Display parsed string
 | 
					 | 
				
			||||||
		output.push(&format!(
 | 
					 | 
				
			||||||
			" [s]=>[n] {left} = {}\n\n",
 | 
					 | 
				
			||||||
			g.display(context)
 | 
					 | 
				
			||||||
		));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Evaluate expression with shadow variables
 | 
					 | 
				
			||||||
		for a in &args { context.add_shadow(a.to_string(), None);}
 | 
					 | 
				
			||||||
		let g_evaluated = evaluate::evaluate(context, &g);
 | 
					 | 
				
			||||||
		context.clear_shadow();
 | 
					 | 
				
			||||||
		let Ok(_g_evaluated) = g_evaluated else {
 | 
					 | 
				
			||||||
			let Err((l, e)) = g_evaluated else { unreachable!() };
 | 
					 | 
				
			||||||
			return Err((
 | 
					 | 
				
			||||||
				LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
					 | 
				
			||||||
				e
 | 
					 | 
				
			||||||
			));
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// We could push g_evaluated instead, but an un-evaluated string
 | 
					 | 
				
			||||||
		// makes the 'vars' command prettier.
 | 
					 | 
				
			||||||
		//
 | 
					 | 
				
			||||||
		// We still need to evaluate g above, though, to make sure it works.
 | 
					 | 
				
			||||||
		context.push_function(name, args, g).unwrap();
 | 
					 | 
				
			||||||
						} else {
 | 
											} else {
 | 
				
			||||||
 | 
												let r = crate::do_string(&mut context, &in_str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if !context.valid_varible(&left) {
 | 
												match r {
 | 
				
			||||||
			return Err((
 | 
													Ok(t) | Err(t) => {
 | 
				
			||||||
				LineLocation{ pos: starting_left, len: left.chars().count() },
 | 
														t.write(&context, &mut stdout).unwrap();
 | 
				
			||||||
				DaisyError::BadVariable
 | 
													}
 | 
				
			||||||
			));
 | 
												}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Parse right hand side
 | 
											break;
 | 
				
			||||||
		let g = parser::parse(context, &right);
 | 
										},
 | 
				
			||||||
		let Ok(g) = g else {
 | 
					
 | 
				
			||||||
			let Err((l, e)) = g else { unreachable!() };
 | 
										// Only process sane characters
 | 
				
			||||||
			return Err((
 | 
										'a'..='z' | 'A'..='Z' | '0'..='9'
 | 
				
			||||||
				LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
										|'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')'
 | 
				
			||||||
				e
 | 
										|'?'|'~'|','|'.'|'['|']'|' '
 | 
				
			||||||
			));
 | 
										|'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';'
 | 
				
			||||||
 | 
										=> { pb.add_char(*q); },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										_ => {}
 | 
				
			||||||
 | 
									};
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									match c.unwrap() {
 | 
				
			||||||
 | 
										Key::Backspace => { pb.backspace(); },
 | 
				
			||||||
 | 
										Key::Delete => { pb.delete(); },
 | 
				
			||||||
 | 
										Key::Left => { pb.cursor_left(); },
 | 
				
			||||||
 | 
										Key::Right => { pb.cursor_right(); },
 | 
				
			||||||
 | 
										Key::Up => { pb.hist_up(); },
 | 
				
			||||||
 | 
										Key::Down => { pb.hist_down(); },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										Key::Ctrl('d') |
 | 
				
			||||||
 | 
										Key::Ctrl('c') => { break 'outer; },
 | 
				
			||||||
 | 
										_ => {}
 | 
				
			||||||
 | 
									};
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Display parsed string
 | 
								let t = pb.write_prompt(&mut context);
 | 
				
			||||||
		output.push(&format!(
 | 
								t.write(&context, &mut stdout)?;
 | 
				
			||||||
			" [t]=>[n] {left} = {}\n\n",
 | 
							}
 | 
				
			||||||
			g.display(context)
 | 
					 | 
				
			||||||
		));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Evaluate expression
 | 
					 | 
				
			||||||
		let g_evaluated = evaluate::evaluate(context, &g);
 | 
					 | 
				
			||||||
		let Ok(g_evaluated) = g_evaluated else {
 | 
					 | 
				
			||||||
			let Err((l, e)) = g_evaluated else { unreachable!() };
 | 
					 | 
				
			||||||
			return Err((
 | 
					 | 
				
			||||||
				LineLocation{ pos: l.pos + starting_right, len: l.len},
 | 
					 | 
				
			||||||
				e
 | 
					 | 
				
			||||||
			));
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		context.push_variable(left.to_string(), g_evaluated).unwrap();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return Ok(output);
 | 
						FormattedText::newline(&mut stdout)?;
 | 
				
			||||||
 | 
						return Ok(());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,23 @@ use super::super::LineLocation;
 | 
				
			|||||||
#[derive(Debug)]
 | 
					#[derive(Debug)]
 | 
				
			||||||
#[derive(Clone)]
 | 
					#[derive(Clone)]
 | 
				
			||||||
pub enum Expression {
 | 
					pub enum Expression {
 | 
				
			||||||
 | 
						// Meaning of `LineLocation`:
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// For Variables, Constants, Quantities, Tuples:
 | 
				
			||||||
 | 
						// If this expression was parsed, LineLocation is what part of the prompt was parsed to get this expression
 | 
				
			||||||
 | 
						// If this expression is the result of a calculation, LineLocaion is the sum of the LineLocations of
 | 
				
			||||||
 | 
						//	all expressions used to make it. In other words, it points to the part of the prompt that was evaluated
 | 
				
			||||||
 | 
						//	to get this new expression.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// For Operators:
 | 
				
			||||||
 | 
						// Linelocation points to the operator's position in the prompt.
 | 
				
			||||||
 | 
						// If this is a function, it points to the function name.
 | 
				
			||||||
 | 
						// If this is `+`, `!`, or etc, it points to that character.
 | 
				
			||||||
 | 
						// Operator arguments are NOT included in this linelocation.
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// All the above rules are implemented when parsing and evaluating expressions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Variable(LineLocation, String),
 | 
						Variable(LineLocation, String),
 | 
				
			||||||
	Quantity(LineLocation, Quantity),
 | 
						Quantity(LineLocation, Quantity),
 | 
				
			||||||
	Constant(LineLocation, Constant),
 | 
						Constant(LineLocation, Constant),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,8 +21,10 @@ pub fn parse(
 | 
				
			|||||||
	context: &Context, s: &String
 | 
						context: &Context, s: &String
 | 
				
			||||||
) -> Result<Expression, (LineLocation, DaisyError)> {
 | 
					) -> Result<Expression, (LineLocation, DaisyError)> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let expressions = stage::tokenize(context, s);
 | 
						let mut expressions = stage::tokenize(context, s);
 | 
				
			||||||
	let (_, expressions) = stage::find_subs(expressions);
 | 
						if context.config.enable_substituion {
 | 
				
			||||||
 | 
							(_, expressions) = stage::find_subs(expressions);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	let g = stage::groupify(context, expressions)?;
 | 
						let g = stage::groupify(context, expressions)?;
 | 
				
			||||||
	let g = stage::treeify(context, g)?;
 | 
						let g = stage::treeify(context, g)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -33,7 +35,14 @@ pub fn parse_no_context(s: &String) -> Result<Expression, (LineLocation, DaisyEr
 | 
				
			|||||||
	parse(&Context::new(), s)
 | 
						parse(&Context::new(), s)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Substitiution replaces certain string with pretty unicode characters.
 | 
				
			||||||
 | 
					// When it is enabled, ALL input strings are substituted. Variable and
 | 
				
			||||||
 | 
					// operator tokens use the replaced string value. Make sure both the
 | 
				
			||||||
 | 
					// original and the replaced strings are handled correctly by the parser.
 | 
				
			||||||
pub fn substitute(context: &Context, s: &String) -> String {
 | 
					pub fn substitute(context: &Context, s: &String) -> String {
 | 
				
			||||||
 | 
						if !context.config.enable_substituion { return s.clone(); }
 | 
				
			||||||
	let (_, s) = substitute_cursor(context, s, s.chars().count());
 | 
						let (_, s) = substitute_cursor(context, s, s.chars().count());
 | 
				
			||||||
	return s;
 | 
						return s;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -43,34 +52,45 @@ pub fn substitute_cursor(
 | 
				
			|||||||
	s: &String, // The string to substitute
 | 
						s: &String, // The string to substitute
 | 
				
			||||||
	c: usize    // Location of the cursor right now
 | 
						c: usize    // Location of the cursor right now
 | 
				
			||||||
) -> (
 | 
					) -> (
 | 
				
			||||||
	usize,  // Location of cursor in substituted string
 | 
						usize,  // New cursor
 | 
				
			||||||
	String  // String with substitutions
 | 
						String  // String with substitutions
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if !context.config.enable_substituion { return (c, s.clone()); }
 | 
				
			||||||
	if s == "" { return (c, s.clone()) }
 | 
						if s == "" { return (c, s.clone()) }
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	let mut new_s = s.clone();
 | 
						let mut new_s = s.clone();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	let l = s.chars().count();
 | 
					 | 
				
			||||||
	let expressions = stage::tokenize(context, s);
 | 
						let expressions = stage::tokenize(context, s);
 | 
				
			||||||
	let (mut subs, _) = stage::find_subs(expressions);
 | 
						let (mut subs, _) = stage::find_subs(expressions);
 | 
				
			||||||
	let mut new_c = l - c;
 | 
						let mut new_c = c.clone();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while subs.len() > 0 {
 | 
						while subs.len() > 0 {
 | 
				
			||||||
		let r = subs.pop_back().unwrap();
 | 
					 | 
				
			||||||
		// Apply substitutions in reverse order
 | 
							// Apply substitutions in reverse order
 | 
				
			||||||
 | 
							// r is the current substitution: (linelocation, string)
 | 
				
			||||||
 | 
							let r = subs.pop_back().unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if { // Don't substitute if our cursor is inside the substitution
 | 
							if { // Don't substitute if our cursor is inside the substitution
 | 
				
			||||||
			c >= r.0.pos &&
 | 
								c >= r.0.pos &&
 | 
				
			||||||
			c < r.0.pos+r.0.len
 | 
								c < r.0.pos+r.0.len
 | 
				
			||||||
		} { continue; }
 | 
							} { continue; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if c < r.0.pos {
 | 
							// If this substitution is before our cursor,
 | 
				
			||||||
			let ct = r.1.chars().count();
 | 
							// we need to adjust our cursor's position.
 | 
				
			||||||
			if ct >= r.0.len {
 | 
							if c > r.0.pos {
 | 
				
			||||||
				if new_c >= ct - r.0.len {
 | 
								let c_o = r.0.len; // Old length 
 | 
				
			||||||
					new_c += ct - r.0.len
 | 
								let c_n = r.1.chars().count(); // New length
 | 
				
			||||||
				}
 | 
					
 | 
				
			||||||
			} else {
 | 
								if c_n > c_o {
 | 
				
			||||||
				new_c -= r.0.len - ct
 | 
									// Move cursor right by difference
 | 
				
			||||||
 | 
									new_c += c_n - c_o;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								} else if c_n < c_o {
 | 
				
			||||||
 | 
									// Move cursor left by difference
 | 
				
			||||||
 | 
									if new_c >= c_o - c_n {
 | 
				
			||||||
 | 
										new_c -= c_o - c_n;
 | 
				
			||||||
 | 
									} else { new_c = 0; }
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,11 +6,69 @@ use super::super::{
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn sub_string(s: &str) -> Option<&'static str> {
 | 
				
			||||||
 | 
						let r = match s {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* Only found in operator tokens */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							"*"    => "×",
 | 
				
			||||||
 | 
							"/"    => "÷",
 | 
				
			||||||
 | 
							"sqrt" => "√",
 | 
				
			||||||
 | 
							"rt"   => "√",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* Only found in word tokens */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Greek letters
 | 
				
			||||||
 | 
							"alpha"   => "α",
 | 
				
			||||||
 | 
							"beta"    => "β",
 | 
				
			||||||
 | 
							"gamma"   => "γ",
 | 
				
			||||||
 | 
							"delta"   => "δ",
 | 
				
			||||||
 | 
							"epsilon" => "ε",
 | 
				
			||||||
 | 
							"zeta"    => "ζ",
 | 
				
			||||||
 | 
							"eta"     => "η",
 | 
				
			||||||
 | 
							"theta"   => "θ",
 | 
				
			||||||
 | 
							//"iota"    => {Some("ι")}, // looks just like i
 | 
				
			||||||
 | 
							//"kappa"   => {Some("κ")}, // looks just like k
 | 
				
			||||||
 | 
							"lambda"  => "λ",
 | 
				
			||||||
 | 
							"mu"      => "μ",
 | 
				
			||||||
 | 
							//"nu"      => {Some("ν")}, // looks just like v
 | 
				
			||||||
 | 
							"xi"      => "ξ",
 | 
				
			||||||
 | 
							//"omicron" => {Some("ο")}, // looks exactly like o
 | 
				
			||||||
 | 
							"pi"      => "π",
 | 
				
			||||||
 | 
							"rho"     => "ρ",
 | 
				
			||||||
 | 
							"sigma"   => "σ",
 | 
				
			||||||
 | 
							"tau"     => "τ",
 | 
				
			||||||
 | 
							//"upsilon" => {Some("υ")}, // looks just like u
 | 
				
			||||||
 | 
							"phi"     => "φ",
 | 
				
			||||||
 | 
							"chi"     => "χ",
 | 
				
			||||||
 | 
							//"psi"     => {Some("ψ")},  Conflict with pound / square inch
 | 
				
			||||||
 | 
							"omega"   => "ω",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Constants
 | 
				
			||||||
 | 
							"epsilon_zero" => "ε₀",
 | 
				
			||||||
 | 
							"eps_zero"     => "ε₀",
 | 
				
			||||||
 | 
							"g_zero"       => "g₀",
 | 
				
			||||||
 | 
							"mu_zero"      => "μ₀",
 | 
				
			||||||
 | 
							"h_bar"        => "ℏ",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Misc
 | 
				
			||||||
 | 
							"deg" => "°",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							_ => { return None; }
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
						return Some(r);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Finds substitutions in an array of tokens.
 | 
				
			||||||
 | 
					// Returns new token array and substitution list.
 | 
				
			||||||
pub fn find_subs(
 | 
					pub fn find_subs(
 | 
				
			||||||
	mut g: VecDeque<Token>,
 | 
						mut g: VecDeque<Token>,
 | 
				
			||||||
) -> (
 | 
					) -> (
 | 
				
			||||||
	VecDeque<(LineLocation, String)>,
 | 
						VecDeque<(LineLocation, String)>, // List of substrings to replace (in order)
 | 
				
			||||||
	VecDeque<Token>
 | 
						VecDeque<Token> // New token array, with updated strings and linelocations
 | 
				
			||||||
) {
 | 
					) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Array of replacements
 | 
						// Array of replacements
 | 
				
			||||||
@@ -24,62 +82,19 @@ pub fn find_subs(
 | 
				
			|||||||
	while g.len() > 0 {
 | 
						while g.len() > 0 {
 | 
				
			||||||
		let mut t = g.pop_front().unwrap();
 | 
							let mut t = g.pop_front().unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		let target: Option<&str> = match &mut t {
 | 
							let target: Option<&str> = match &mut t {
 | 
				
			||||||
			Token::Operator(_, s) => {
 | 
								Token::Operator(_, s) => {
 | 
				
			||||||
				let target = match &s[..] {
 | 
									let target = sub_string(s);
 | 
				
			||||||
					"*" => {Some("×")},
 | 
					 | 
				
			||||||
					"/" => {Some("÷")},
 | 
					 | 
				
			||||||
					"sqrt"    => {Some("√")},
 | 
					 | 
				
			||||||
					"rt"      => {Some("√")},
 | 
					 | 
				
			||||||
					_ => {None}
 | 
					 | 
				
			||||||
				};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// Update token contents too.
 | 
									// Update token contents too.
 | 
				
			||||||
				// This makes sure that errors also contain the updated text.
 | 
									// This makes errors and printouts use the updated string.
 | 
				
			||||||
				if target.is_some() { *s = String::from(target.unwrap()); }
 | 
									if target.is_some() { *s = String::from(target.unwrap()); }
 | 
				
			||||||
				target
 | 
									target
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			Token::Word(_, s) => {
 | 
								Token::Word(_, s) => {
 | 
				
			||||||
				let target = match &s[..] {
 | 
									let target = sub_string(s);
 | 
				
			||||||
					// Greek letters
 | 
					 | 
				
			||||||
					"alpha"   => {Some("α")},
 | 
					 | 
				
			||||||
					"beta"    => {Some("β")},
 | 
					 | 
				
			||||||
					"gamma"   => {Some("γ")},
 | 
					 | 
				
			||||||
					"delta"   => {Some("δ")},
 | 
					 | 
				
			||||||
					"epsilon" => {Some("ε")},
 | 
					 | 
				
			||||||
					"zeta"    => {Some("ζ")},
 | 
					 | 
				
			||||||
					"eta"     => {Some("η")},
 | 
					 | 
				
			||||||
					"theta"   => {Some("θ")},
 | 
					 | 
				
			||||||
					//"iota"    => {Some("ι")},
 | 
					 | 
				
			||||||
					//"kappa"   => {Some("κ")},
 | 
					 | 
				
			||||||
					"lambda"  => {Some("λ")},
 | 
					 | 
				
			||||||
					"mu"      => {Some("μ")},
 | 
					 | 
				
			||||||
					//"nu"      => {Some("ν")},
 | 
					 | 
				
			||||||
					"xi"      => {Some("ξ")},
 | 
					 | 
				
			||||||
					//"omicron" => {Some("ο")},
 | 
					 | 
				
			||||||
					"pi"      => {Some("π")},
 | 
					 | 
				
			||||||
					"rho"     => {Some("ρ")},
 | 
					 | 
				
			||||||
					"sigma"   => {Some("σ")},
 | 
					 | 
				
			||||||
					"tau"     => {Some("τ")},
 | 
					 | 
				
			||||||
					//"upsilon" => {Some("υ")},
 | 
					 | 
				
			||||||
					"phi"     => {Some("φ")},
 | 
					 | 
				
			||||||
					"chi"     => {Some("χ")},
 | 
					 | 
				
			||||||
					//"psi"     => {Some("ψ")},  Conflict with pound / square inch
 | 
					 | 
				
			||||||
					"omega"   => {Some("ω")},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					// Constants
 | 
					 | 
				
			||||||
					"epsilon_zero" => {Some("ε₀")},
 | 
					 | 
				
			||||||
					"eps_zero"     => {Some("ε₀")},
 | 
					 | 
				
			||||||
					"g_zero"       => {Some("g₀")},
 | 
					 | 
				
			||||||
					"mu_zero"      => {Some("μ₀")},
 | 
					 | 
				
			||||||
					"h_bar"        => {Some("ℏ")},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
					// Misc
 | 
					 | 
				
			||||||
					"deg" => {Some("°")}
 | 
					 | 
				
			||||||
					_ => {None}
 | 
					 | 
				
			||||||
				};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				if target.is_some() { *s = String::from(target.unwrap()); }
 | 
									if target.is_some() { *s = String::from(target.unwrap()); }
 | 
				
			||||||
				target
 | 
									target
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
@@ -88,7 +103,7 @@ pub fn find_subs(
 | 
				
			|||||||
		};
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if target.is_none() {
 | 
							if target.is_none() {
 | 
				
			||||||
			// Even if nothing changed, we need to update token location
 | 
								// Even if nothing changed, we need to update the new token's linelocation
 | 
				
			||||||
			let l = t.get_mut_linelocation();
 | 
								let l = t.get_mut_linelocation();
 | 
				
			||||||
			*l = LineLocation{pos: l.pos - offset, len: l.len};
 | 
								*l = LineLocation{pos: l.pos - offset, len: l.len};
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,9 @@
 | 
				
			|||||||
use std::collections::VecDeque;
 | 
					use std::collections::VecDeque;
 | 
				
			||||||
use std::io::Write;
 | 
					use crate::FormattedText;
 | 
				
			||||||
use termion::raw::RawTerminal;
 | 
					 | 
				
			||||||
use termion::color;
 | 
					 | 
				
			||||||
use termion::style;
 | 
					 | 
				
			||||||
use crate::parser::substitute_cursor;
 | 
					use crate::parser::substitute_cursor;
 | 
				
			||||||
use crate::context::Context;
 | 
					use crate::Context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const PROMPT_STR: &str = "==> ";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Debug)]
 | 
					#[derive(Debug)]
 | 
				
			||||||
pub struct PromptBuffer {
 | 
					pub struct PromptBuffer {
 | 
				
			||||||
@@ -17,12 +16,49 @@ pub struct PromptBuffer {
 | 
				
			|||||||
	// 1 means "on last item of history"
 | 
						// 1 means "on last item of history"
 | 
				
			||||||
	hist_cursor: usize,
 | 
						hist_cursor: usize,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	buffer: String,
 | 
						pub buffer: String,
 | 
				
			||||||
	buffer_changed: bool,
 | 
						buffer_changed: bool,
 | 
				
			||||||
	cursor: usize,
 | 
						cursor: usize,
 | 
				
			||||||
	last_print_len: usize
 | 
						last_print_len: usize
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					impl PromptBuffer {
 | 
				
			||||||
 | 
						// Same as write_primpt, but pretends there is no cursor
 | 
				
			||||||
 | 
						pub fn write_prompt_nocursor(&mut self, context: &Context) -> FormattedText {
 | 
				
			||||||
 | 
							let tmp = self.cursor;
 | 
				
			||||||
 | 
							self.cursor = 0;
 | 
				
			||||||
 | 
							let r = self.write_prompt(context);
 | 
				
			||||||
 | 
							self.cursor = tmp;
 | 
				
			||||||
 | 
							return r;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pub fn write_prompt(&mut self, context: &Context) -> FormattedText {
 | 
				
			||||||
 | 
							let l = self.buffer.chars().count();
 | 
				
			||||||
 | 
							let i = if l == 0 {0} else {l - self.cursor};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// Draw prettyprinted expression
 | 
				
			||||||
 | 
							let (display_c, s) = substitute_cursor(context, &self.get_contents(), i);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
							let mut tx = FormattedText::new("".to_string());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							tx.push(&format!("\r[p]{PROMPT_STR}[n]{s}"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// If this string is shorter, clear the remaining old one.
 | 
				
			||||||
 | 
							if s.chars().count() < self.last_print_len {
 | 
				
			||||||
 | 
								tx.push(&" ".repeat(self.last_print_len - s.chars().count()));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							let q = (display_c + PROMPT_STR.chars().count()) as u16;
 | 
				
			||||||
 | 
							tx.push(&format!("\r[cursorright{q}]"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							self.last_print_len = s.chars().count();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return tx;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl PromptBuffer {
 | 
					impl PromptBuffer {
 | 
				
			||||||
	pub fn new(maxlen: usize) -> PromptBuffer {
 | 
						pub fn new(maxlen: usize) -> PromptBuffer {
 | 
				
			||||||
		return PromptBuffer {
 | 
							return PromptBuffer {
 | 
				
			||||||
@@ -36,75 +72,6 @@ impl PromptBuffer {
 | 
				
			|||||||
		};
 | 
							};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Same as write_primpt, but pretends there is no cursor
 | 
					 | 
				
			||||||
	pub fn write_prompt_nocursor(&mut self, context: &Context, stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io::Error> {
 | 
					 | 
				
			||||||
		// Draw prettyprinted expression
 | 
					 | 
				
			||||||
		let (_, s) = substitute_cursor(context, &self.get_contents(), self.buffer.chars().count());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		write!(
 | 
					 | 
				
			||||||
			stdout, "\r{}{}==>{}{} {}",
 | 
					 | 
				
			||||||
			style::Bold,
 | 
					 | 
				
			||||||
			color::Fg(color::Blue),
 | 
					 | 
				
			||||||
			color::Fg(color::Reset),
 | 
					 | 
				
			||||||
			style::Reset,
 | 
					 | 
				
			||||||
			s
 | 
					 | 
				
			||||||
		)?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// If this string is shorter, clear the remaining old one.
 | 
					 | 
				
			||||||
		if s.chars().count() < self.last_print_len {
 | 
					 | 
				
			||||||
			write!(
 | 
					 | 
				
			||||||
				stdout, "{}{}",
 | 
					 | 
				
			||||||
				" ".repeat(self.last_print_len - s.chars().count()),
 | 
					 | 
				
			||||||
				termion::cursor::Left((self.last_print_len - s.chars().count()) as u16)
 | 
					 | 
				
			||||||
			)?;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		self.last_print_len = s.chars().count();
 | 
					 | 
				
			||||||
		stdout.flush()?;
 | 
					 | 
				
			||||||
		return Ok(());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	pub fn write_prompt(&mut self, context: &Context, stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io::Error> {
 | 
					 | 
				
			||||||
		let l = self.buffer.chars().count();
 | 
					 | 
				
			||||||
		let i = if l == 0 {0} else {l - self.cursor};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Draw prettyprinted expression
 | 
					 | 
				
			||||||
		let (display_cursor, s) = substitute_cursor(context, &self.get_contents(), i);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		write!(
 | 
					 | 
				
			||||||
			stdout, "\r{}{}==>{}{} {}",
 | 
					 | 
				
			||||||
			style::Bold,
 | 
					 | 
				
			||||||
			color::Fg(color::Blue),
 | 
					 | 
				
			||||||
			color::Fg(color::Reset),
 | 
					 | 
				
			||||||
			style::Reset,
 | 
					 | 
				
			||||||
			s
 | 
					 | 
				
			||||||
		)?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// If this string is shorter, clear the remaining old one.
 | 
					 | 
				
			||||||
		if s.chars().count() < self.last_print_len {
 | 
					 | 
				
			||||||
			write!(
 | 
					 | 
				
			||||||
				stdout, "{}{}",
 | 
					 | 
				
			||||||
				" ".repeat(self.last_print_len - s.chars().count()),
 | 
					 | 
				
			||||||
				termion::cursor::Left((self.last_print_len - s.chars().count()) as u16)
 | 
					 | 
				
			||||||
			)?;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Move cursor to correct position
 | 
					 | 
				
			||||||
		if display_cursor != 0 {
 | 
					 | 
				
			||||||
			write!(
 | 
					 | 
				
			||||||
				stdout, "{}",
 | 
					 | 
				
			||||||
				termion::cursor::Left(display_cursor as u16)
 | 
					 | 
				
			||||||
			)?;
 | 
					 | 
				
			||||||
			stdout.flush()?;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		self.last_print_len = s.chars().count();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		stdout.flush()?;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return Ok(());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Prompt methods
 | 
						// Prompt methods
 | 
				
			||||||
	pub fn get_contents(&self) -> &String {&self.buffer}
 | 
						pub fn get_contents(&self) -> &String {&self.buffer}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -8,6 +8,7 @@ use std::ops::{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use std::cmp::Ordering;
 | 
					use std::cmp::Ordering;
 | 
				
			||||||
use super::ScalarBase;
 | 
					use super::ScalarBase;
 | 
				
			||||||
 | 
					use super::dec_to_sci;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
macro_rules! foward {
 | 
					macro_rules! foward {
 | 
				
			||||||
@@ -25,16 +26,39 @@ pub struct F64Base where {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ToString for F64Base {
 | 
					impl ToString for F64Base {
 | 
				
			||||||
	fn to_string(&self) -> String { self.val.to_string() }
 | 
						fn to_string(&self) -> String {
 | 
				
			||||||
 | 
							// Remove negative sign from string
 | 
				
			||||||
 | 
							let mut s = self.val.to_string();
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							let neg = s.starts_with("-");
 | 
				
			||||||
 | 
							if neg { s = String::from(&s[1..]); }
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							// Power of ten
 | 
				
			||||||
 | 
							let mut p: i64 = {
 | 
				
			||||||
 | 
								if let Some(x) = s.find(".") {
 | 
				
			||||||
 | 
									x as i64
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									s.len() as i64
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
							p -= 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// We no longer need a decimal point in our string.
 | 
				
			||||||
 | 
							// also, trim off leading zeros and adjust power.
 | 
				
			||||||
 | 
							let mut s: &str = &s.replace(".", "");
 | 
				
			||||||
 | 
							s = &s[0..];
 | 
				
			||||||
 | 
							s = s.trim_end_matches('0');
 | 
				
			||||||
 | 
							while s.starts_with('0') {
 | 
				
			||||||
 | 
								s = &s[1..];
 | 
				
			||||||
 | 
								p -= 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return dec_to_sci(neg, s.to_string(), p);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ScalarBase for F64Base {
 | 
					impl ScalarBase for F64Base {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	fn from_f64(f: f64) -> Option<F64Base> {
 | 
					 | 
				
			||||||
		return Some(F64Base{ val: f });
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	fn from_string(s: &str) -> Option<F64Base> {
 | 
						fn from_string(s: &str) -> Option<F64Base> {
 | 
				
			||||||
		let v = s.parse::<f64>();
 | 
							let v = s.parse::<f64>();
 | 
				
			||||||
		let v = match v {
 | 
							let v = match v {
 | 
				
			||||||
@@ -51,6 +75,7 @@ impl ScalarBase for F64Base {
 | 
				
			|||||||
	fn is_one(&self) -> bool {self.val == 1f64}
 | 
						fn is_one(&self) -> bool {self.val == 1f64}
 | 
				
			||||||
	fn is_negative(&self) -> bool { self.val.is_sign_negative() }
 | 
						fn is_negative(&self) -> bool { self.val.is_sign_negative() }
 | 
				
			||||||
	fn is_positive(&self) -> bool { self.val.is_sign_positive() }
 | 
						fn is_positive(&self) -> bool { self.val.is_sign_positive() }
 | 
				
			||||||
 | 
						fn is_int(&self) -> bool { self.val.floor() == self.val }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	foward!(abs);
 | 
						foward!(abs);
 | 
				
			||||||
	foward!(floor);
 | 
						foward!(floor);
 | 
				
			||||||
@@ -60,9 +85,11 @@ impl ScalarBase for F64Base {
 | 
				
			|||||||
	foward!(sin);
 | 
						foward!(sin);
 | 
				
			||||||
	foward!(cos);
 | 
						foward!(cos);
 | 
				
			||||||
	foward!(tan);
 | 
						foward!(tan);
 | 
				
			||||||
	foward!(csc);
 | 
					
 | 
				
			||||||
	foward!(sec);
 | 
						fn csc(&self) -> Option<F64Base> { Some(F64Base{ val: 1f64/self.val.sin() }) }
 | 
				
			||||||
	foward!(cot);
 | 
						fn sec(&self) -> Option<F64Base> { Some(F64Base{ val: 1f64/self.val.cos() }) }
 | 
				
			||||||
 | 
						fn cot(&self) -> Option<F64Base> { Some(F64Base{ val: 1f64/self.val.tan() }) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	foward!(asin);
 | 
						foward!(asin);
 | 
				
			||||||
	foward!(acos);
 | 
						foward!(acos);
 | 
				
			||||||
	foward!(atan);
 | 
						foward!(atan);
 | 
				
			||||||
@@ -70,9 +97,11 @@ impl ScalarBase for F64Base {
 | 
				
			|||||||
	foward!(sinh);
 | 
						foward!(sinh);
 | 
				
			||||||
	foward!(cosh);
 | 
						foward!(cosh);
 | 
				
			||||||
	foward!(tanh);
 | 
						foward!(tanh);
 | 
				
			||||||
	foward!(csch);
 | 
					
 | 
				
			||||||
	foward!(sech);
 | 
						fn csch(&self) -> Option<F64Base> { Some(F64Base{ val: 1f64/self.val.sinh() }) }
 | 
				
			||||||
	foward!(coth);
 | 
						fn sech(&self) -> Option<F64Base> { Some(F64Base{ val: 1f64/self.val.cosh() }) }
 | 
				
			||||||
 | 
						fn coth(&self) -> Option<F64Base> { Some(F64Base{ val: 1f64/self.val.tanh() }) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	foward!(asinh);
 | 
						foward!(asinh);
 | 
				
			||||||
	foward!(acosh);
 | 
						foward!(acosh);
 | 
				
			||||||
	foward!(atanh);
 | 
						foward!(atanh);
 | 
				
			||||||
@@ -161,11 +190,11 @@ impl Rem<F64Base> for F64Base {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	fn rem(self, modulus: F64Base) -> Self::Output {
 | 
						fn rem(self, modulus: F64Base) -> Self::Output {
 | 
				
			||||||
		if {
 | 
							if {
 | 
				
			||||||
			(!self.fract().unwrap().is_zero()) ||
 | 
								(!self.is_int()) ||
 | 
				
			||||||
			(!modulus.fract().unwrap().is_zero())
 | 
								(!modulus.is_int())
 | 
				
			||||||
		} { panic!() }
 | 
							} { panic!() }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		F64Base{val : self.val.fract() % modulus.val.fract()}
 | 
							F64Base{val : self.val.round() % modulus.val.round()}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
use rug::Float;
 | 
					use bigdecimal::BigDecimal;
 | 
				
			||||||
use rug::Assign;
 | 
					use bigdecimal::Zero;
 | 
				
			||||||
use rug::ops::AssignRound;
 | 
					use bigdecimal::RoundingMode;
 | 
				
			||||||
use rug::ops::Pow;
 | 
					use std::str::FromStr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::ops::{
 | 
					use std::ops::{
 | 
				
			||||||
	Add, Sub, Mul, Div,
 | 
						Add, Sub, Mul, Div,
 | 
				
			||||||
@@ -14,158 +14,151 @@ use std::ops::{
 | 
				
			|||||||
use std::cmp::Ordering;
 | 
					use std::cmp::Ordering;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use super::ScalarBase;
 | 
					use super::ScalarBase;
 | 
				
			||||||
use super::PRINT_LEN;
 | 
					use super::dec_to_sci;
 | 
				
			||||||
use super::FLOAT_PRECISION;
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Debug)]
 | 
					#[derive(Debug)]
 | 
				
			||||||
#[derive(Clone)]
 | 
					#[derive(Clone)]
 | 
				
			||||||
pub struct FloatBase where {
 | 
					pub struct FloatBase where {
 | 
				
			||||||
	pub val: Float
 | 
						pub val: BigDecimal
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl FloatBase {
 | 
					impl FloatBase {
 | 
				
			||||||
	pub fn from<T>(a: T) -> Option<FloatBase> where
 | 
						pub fn new(s: &str) -> FloatBase {
 | 
				
			||||||
		Float: Assign<T> + AssignRound<T>
 | 
							return FloatBase {
 | 
				
			||||||
	{
 | 
								val: s.parse().unwrap()
 | 
				
			||||||
		let v = Float::with_val(FLOAT_PRECISION, a);
 | 
							};
 | 
				
			||||||
		return Some(FloatBase{ val: v });
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ToString for FloatBase {
 | 
					impl ToString for FloatBase {
 | 
				
			||||||
	fn to_string(&self) -> String {
 | 
						fn to_string(&self) -> String {
 | 
				
			||||||
		let (sign, mut string, exp) = self.val.to_sign_string_exp(10, Some(PRINT_LEN));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// zero, nan, or inf.
 | 
							if self.val.is_nan() {
 | 
				
			||||||
		let sign = if sign {"-"} else {""};
 | 
								return "NaN".to_string();
 | 
				
			||||||
		if exp.is_none() { return format!("{sign}{string}"); }
 | 
							} else if self.val.is_inf_neg() {
 | 
				
			||||||
		let exp = exp.unwrap();
 | 
								return "-Inf".to_string();
 | 
				
			||||||
 | 
							} else if self.val.is_inf_pos() {
 | 
				
			||||||
		// Remove trailing zeros.
 | 
								return "+Inf".to_string();
 | 
				
			||||||
		// At this point, string is guaranteed to be nonzero.
 | 
					 | 
				
			||||||
		while string.chars().last().unwrap() == '0' {
 | 
					 | 
				
			||||||
			string.remove(string.len() - 1);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		let exp_u: usize;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if exp < 0 {
 | 
							// Already in scientific notation,we just need to trim significant digits.
 | 
				
			||||||
			exp_u = (-exp).try_into().unwrap()
 | 
							let mut _a = self.val.round(32, astro_float::RoundingMode::Up).to_string();
 | 
				
			||||||
		} else {
 | 
							let mut _b = _a.split('e');
 | 
				
			||||||
			exp_u = exp.try_into().unwrap()
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if exp_u >= PRINT_LEN {
 | 
							let mut s = String::from(_b.next().unwrap()); // Decimal
 | 
				
			||||||
			// Exponential notation
 | 
							let p: i64 = _b.next().unwrap().parse().unwrap(); // Exponent
 | 
				
			||||||
			let pre = &string[0..1];
 | 
					 | 
				
			||||||
			let post = &string[1..];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			format!(
 | 
							// Remove negative sign from string
 | 
				
			||||||
				"{pre}{}{post}e{}",
 | 
							let neg = s.starts_with("-");
 | 
				
			||||||
				if post.len() != 0 {"."} else {""},
 | 
							if neg { s = String::from(&s[1..]); }
 | 
				
			||||||
				//if exp > 0 {"+"} else {""},
 | 
					 | 
				
			||||||
				exp - 1
 | 
					 | 
				
			||||||
			)
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			if exp <= 0 { // Decimal, needs `0.` and leading zeros
 | 
					 | 
				
			||||||
				format!(
 | 
					 | 
				
			||||||
					"{sign}0.{}{string}",
 | 
					 | 
				
			||||||
					"0".repeat(exp_u)
 | 
					 | 
				
			||||||
				)
 | 
					 | 
				
			||||||
			} else if exp_u < string.len() { // Decimal, needs only `.`
 | 
					 | 
				
			||||||
				format!(
 | 
					 | 
				
			||||||
					"{sign}{}.{}",
 | 
					 | 
				
			||||||
					&string[0..exp_u],
 | 
					 | 
				
			||||||
					&string[exp_u..]
 | 
					 | 
				
			||||||
				)
 | 
					 | 
				
			||||||
			} else { // Integer, needs trailing zeros
 | 
					 | 
				
			||||||
				format!(
 | 
					 | 
				
			||||||
					"{sign}{string}{}",
 | 
					 | 
				
			||||||
					"0".repeat(exp_u - string.len())
 | 
					 | 
				
			||||||
				)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// We no longer need a decimal point in our string.
 | 
				
			||||||
 | 
							// also, trim off leading zeros and adjust power.
 | 
				
			||||||
 | 
							let mut s: &str = &s.replace(".", "");
 | 
				
			||||||
 | 
							s = &s[0..];
 | 
				
			||||||
 | 
							s = s.trim_end_matches('0');
 | 
				
			||||||
 | 
							s = s.trim_start_matches('0');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return dec_to_sci(neg, s.to_string(), p);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
macro_rules! foward {
 | 
					 | 
				
			||||||
	( $x:ident ) => {
 | 
					 | 
				
			||||||
		fn $x(&self) -> Option<FloatBase> {
 | 
					 | 
				
			||||||
			Some(FloatBase{ val: self.val.clone().$x()})
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ScalarBase for FloatBase {
 | 
					impl ScalarBase for FloatBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn from_f64(f: f64) -> Option<FloatBase> {
 | 
					 | 
				
			||||||
		let v = Float::with_val(FLOAT_PRECISION, f);
 | 
					 | 
				
			||||||
		return Some(FloatBase{ val: v });
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	fn from_string(s: &str) -> Option<FloatBase> {
 | 
						fn from_string(s: &str) -> Option<FloatBase> {
 | 
				
			||||||
		let v = Float::parse(s);
 | 
							let v = BigDecimal::from_str(s);
 | 
				
			||||||
		let v = match v {
 | 
							let v = match v {
 | 
				
			||||||
			Ok(x) => x,
 | 
								Ok(x) => x,
 | 
				
			||||||
			Err(_) => return None
 | 
								Err(_) => return None
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return Some(
 | 
							return Some(FloatBase{ val: v });
 | 
				
			||||||
			FloatBase{ val:
 | 
					 | 
				
			||||||
				Float::with_val(FLOAT_PRECISION, v)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	foward!(fract);
 | 
						//foward!(fract);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn is_zero(&self) -> bool {self.val.is_zero()}
 | 
						fn is_zero(&self) -> bool {self.val.is_zero()}
 | 
				
			||||||
	fn is_one(&self) -> bool {self.val == Float::with_val(FLOAT_PRECISION, 1)}
 | 
						fn is_one(&self) -> bool {self.val == BigDecimal::from_str("1").unwrap()}
 | 
				
			||||||
	fn is_negative(&self) -> bool { self.val.is_sign_negative() }
 | 
						fn is_negative(&self) -> bool { self.val.sign() == num::bigint::Sign::Minus }
 | 
				
			||||||
	fn is_positive(&self) -> bool { self.val.is_sign_positive() }
 | 
						fn is_positive(&self) -> bool { self.val.sign() == num::bigint::Sign::Plus }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn is_int(&self) -> bool {
 | 
						fn is_int(&self) -> bool { self.val.is_integer() }
 | 
				
			||||||
		self.fract() == FloatBase::from_f64(0f64)
 | 
					
 | 
				
			||||||
 | 
						fn abs(&self) -> Option<FloatBase> { Some(FloatBase{ val: self.val.abs() }) }
 | 
				
			||||||
 | 
						fn round(&self) -> Option<FloatBase> { Some(FloatBase{ val: self.val.round(0) }) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fn floor(&self) -> Option<FloatBase> {
 | 
				
			||||||
 | 
							let (_, scale) = self.val.as_bigint_and_exponent();
 | 
				
			||||||
 | 
							Some(FloatBase{ val: self.val.with_scale_round(scale, RoundingMode::Down) })
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	foward!(abs);
 | 
						fn ceil(&self) -> Option<FloatBase> {
 | 
				
			||||||
	foward!(floor);
 | 
							let (_, scale) = self.val.as_bigint_and_exponent();
 | 
				
			||||||
	foward!(ceil);
 | 
							Some(FloatBase{ val: self.val.with_scale_round(scale, RoundingMode::Up) })
 | 
				
			||||||
	foward!(round);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	foward!(sin);
 | 
					 | 
				
			||||||
	foward!(cos);
 | 
					 | 
				
			||||||
	foward!(tan);
 | 
					 | 
				
			||||||
	foward!(csc);
 | 
					 | 
				
			||||||
	foward!(sec);
 | 
					 | 
				
			||||||
	foward!(cot);
 | 
					 | 
				
			||||||
	foward!(asin);
 | 
					 | 
				
			||||||
	foward!(acos);
 | 
					 | 
				
			||||||
	foward!(atan);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	foward!(sinh);
 | 
					 | 
				
			||||||
	foward!(cosh);
 | 
					 | 
				
			||||||
	foward!(tanh);
 | 
					 | 
				
			||||||
	foward!(csch);
 | 
					 | 
				
			||||||
	foward!(sech);
 | 
					 | 
				
			||||||
	foward!(coth);
 | 
					 | 
				
			||||||
	foward!(asinh);
 | 
					 | 
				
			||||||
	foward!(acosh);
 | 
					 | 
				
			||||||
	foward!(atanh);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	foward!(exp);
 | 
					 | 
				
			||||||
	foward!(ln);
 | 
					 | 
				
			||||||
	foward!(log10);
 | 
					 | 
				
			||||||
	foward!(log2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	fn log(&self, base: FloatBase) -> Option<FloatBase> {
 | 
					 | 
				
			||||||
		Some(FloatBase{ val: self.val.clone().log10() } / base.log10().unwrap())
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn pow(&self, base: FloatBase) -> Option<FloatBase> {
 | 
						fn fract(&self) -> Option<FloatBase> { Some(self.clone() - self.floor().unwrap()) }
 | 
				
			||||||
		Some(FloatBase{ val: self.val.clone().pow(base.val)})
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fn sin(&self) -> Option<FloatBase> {
 | 
				
			||||||
 | 
							let c0: BigDecimal = "1.276278962".parse().unwrap();
 | 
				
			||||||
 | 
							let c1: BigDecimal = "-.285261569".parse().unwrap();
 | 
				
			||||||
 | 
							let c2: BigDecimal = "0.009118016".parse().unwrap();
 | 
				
			||||||
 | 
							let c3: BigDecimal = "-.000136587".parse().unwrap();
 | 
				
			||||||
 | 
							let c4: BigDecimal = "0.000001185".parse().unwrap();
 | 
				
			||||||
 | 
							let c5: BigDecimal = "-.000000007".parse().unwrap();
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// z should be between -0.25 to 0.25 (percent of a full circle)
 | 
				
			||||||
 | 
							let z: BigDecimal = self.val.clone() / 360f64;
 | 
				
			||||||
 | 
							let w = BigDecimal::from(4) * z;
 | 
				
			||||||
 | 
							let x: BigDecimal = 2 * w.clone() * w.clone() - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							let p = (
 | 
				
			||||||
 | 
								c0 * 1 +
 | 
				
			||||||
 | 
								c1 * x.clone() +
 | 
				
			||||||
 | 
								c2 * (2 * x.clone()*x.clone() - 1) +
 | 
				
			||||||
 | 
								c3 * (4 * x.clone()*x.clone()*x.clone() - 3 * x.clone()) +
 | 
				
			||||||
 | 
								c4 * (8 * x.clone()*x.clone()*x.clone()*x.clone() - 8 * x.clone()*x.clone() + 1) +
 | 
				
			||||||
 | 
								c5 * (16 * x.clone()*x.clone()*x.clone()*x.clone()*x.clone() - 20 * x.clone()*x.clone()*x.clone() + 5 * x.clone())
 | 
				
			||||||
 | 
							) * w;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return Some(FloatBase{ val: p })
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						fn cos(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn tan(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn csc(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn sec(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn cot(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn asin(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn acos(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn atan(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn sinh(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn cosh(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn tanh(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn csch(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn sech(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn coth(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn asinh(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn acosh(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn atanh(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn exp(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn ln(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn log10(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
						fn log2(&self) -> Option<FloatBase> { Some(FloatBase{ val: "1".parse().unwrap() }) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fn log(&self, _base: FloatBase) -> Option<FloatBase> {
 | 
				
			||||||
 | 
							Some(FloatBase{ val: "1".parse().unwrap() })
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fn pow(&self, _base: FloatBase) -> Option<FloatBase> {
 | 
				
			||||||
 | 
							Some(FloatBase{ val: "1".parse().unwrap() })
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -223,7 +216,7 @@ impl Div for FloatBase {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl DivAssign for FloatBase where {
 | 
					impl DivAssign for FloatBase where {
 | 
				
			||||||
	fn div_assign(&mut self, other: Self) {
 | 
						fn div_assign(&mut self, other: Self) {
 | 
				
			||||||
		self.val /= other.val;
 | 
							self.val = self.val.clone() / other.val;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -240,11 +233,11 @@ impl Rem<FloatBase> for FloatBase {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	fn rem(self, modulus: FloatBase) -> Self::Output {
 | 
						fn rem(self, modulus: FloatBase) -> Self::Output {
 | 
				
			||||||
		if {
 | 
							if {
 | 
				
			||||||
			(!self.fract().unwrap().is_zero()) ||
 | 
								(!self.is_int()) ||
 | 
				
			||||||
			(!modulus.fract().unwrap().is_zero())
 | 
								(!modulus.is_int())
 | 
				
			||||||
		} { panic!() }
 | 
							} { panic!() }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		FloatBase{val : self.val.fract() % modulus.val.fract()}
 | 
							FloatBase{val : self.val.round(0) % modulus.val.round(0)}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,92 @@
 | 
				
			|||||||
const FLOAT_PRECISION: u32 = 1024;
 | 
					//const FLOAT_PRECISION: u32 = 1024;
 | 
				
			||||||
const PRINT_LEN: usize = 5; // How many significant digits we will show in output
 | 
					const SHOW_SIG: usize = 5; // How many significant digits we will show in output
 | 
				
			||||||
 | 
					const MAX_LEN: usize = 5; // If a scientific exponent is >= this value, do not use scientific notation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub(in self) mod rationalbase;
 | 
					pub(in self) mod rationalbase;
 | 
				
			||||||
pub(in self) mod floatbase;
 | 
					
 | 
				
			||||||
//mod f64base;
 | 
					
 | 
				
			||||||
 | 
					// Pick a float implementation.
 | 
				
			||||||
 | 
					// floatbase is high-precision, f64base is for testing.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//pub(in self) mod floatbase;
 | 
				
			||||||
 | 
					//pub use floatbase::FloatBase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub(in self) mod f64base;
 | 
				
			||||||
 | 
					pub use f64base::F64Base as FloatBase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mod scalar;
 | 
					mod scalar;
 | 
				
			||||||
pub use self::scalar::Scalar;
 | 
					pub use self::scalar::Scalar;
 | 
				
			||||||
pub use self::scalar::ScalarBase;
 | 
					pub use self::scalar::ScalarBase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Convert a string to scientific notation,
 | 
				
			||||||
 | 
					// with parameters SHOW_SIG and MAX_LEN.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// input:
 | 
				
			||||||
 | 
					//  neg: true if negative
 | 
				
			||||||
 | 
					//  s: decimal portion. Must contain only digits and a single decimal point.
 | 
				
			||||||
 | 
					//     zeros must be stripped from both ends.
 | 
				
			||||||
 | 
					//  p: power of ten to multiply by.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  So, (-1)^(neg) + (s * 10^p) should give us our number.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#[allow(dead_code)]
 | 
				
			||||||
 | 
					pub(in self) fn dec_to_sci(neg: bool, mut s: String, p: i64) -> String {
 | 
				
			||||||
 | 
						// Pick significant digits and round
 | 
				
			||||||
 | 
						if s.len() > SHOW_SIG {
 | 
				
			||||||
 | 
							let round;
 | 
				
			||||||
 | 
							if s.len() != SHOW_SIG + 1 {
 | 
				
			||||||
 | 
								round = s[SHOW_SIG..SHOW_SIG+1].parse().unwrap();
 | 
				
			||||||
 | 
							} else { round = 0; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							s = String::from(&s[0..SHOW_SIG]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if round >= 5 {
 | 
				
			||||||
 | 
								let new = s[s.len()-1..s.len()].parse::<u8>().unwrap() + 1u8;
 | 
				
			||||||
 | 
								if new != 10 {
 | 
				
			||||||
 | 
									s = format!("{}{new}", &s[0..s.len()-1]);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						s = format!("{s}{}", "0".repeat(SHOW_SIG - s.len()));
 | 
				
			||||||
 | 
						// at this point, s is guaranteed to have exactly SHOW_SIG digits.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let neg = if neg {"-"} else {""};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (p.abs() as usize) < MAX_LEN {
 | 
				
			||||||
 | 
							// Print whole decimal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if p >= 0 {
 | 
				
			||||||
 | 
								let q = p as usize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								let first = &s[0..q+1];
 | 
				
			||||||
 | 
								let mut rest = &s[q+1..];
 | 
				
			||||||
 | 
								rest = rest.trim_end_matches('0');
 | 
				
			||||||
 | 
								if rest == "" {
 | 
				
			||||||
 | 
									return format!("{neg}{first}");
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									return format!("{neg}{first}.{rest}");
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								let q = p.abs() as usize;
 | 
				
			||||||
 | 
								let t = format!("0.{}{s}", "0".repeat(q-1));
 | 
				
			||||||
 | 
								return format!("{neg}{}", t.trim_end_matches('0'));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							// Print full scientific notation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							let first = &s[0..1];
 | 
				
			||||||
 | 
							let mut rest = &s[1..];
 | 
				
			||||||
 | 
							rest = rest.trim_end_matches('0');
 | 
				
			||||||
 | 
							if rest == "" {
 | 
				
			||||||
 | 
								return format!("{neg}{first}e{p}");
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								return format!("{neg}{first}.{rest}e{p}");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
use rug::Rational;
 | 
					use num::rational::BigRational;
 | 
				
			||||||
use rug::Integer;
 | 
					use num::BigInt;
 | 
				
			||||||
 | 
					use num::Num;
 | 
				
			||||||
 | 
					use num::Signed;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::ops::{
 | 
					use std::ops::{
 | 
				
			||||||
	Add, Sub, Mul, Div,
 | 
						Add, Sub, Mul, Div,
 | 
				
			||||||
@@ -22,7 +24,7 @@ macro_rules! cant_do {
 | 
				
			|||||||
#[derive(Debug)]
 | 
					#[derive(Debug)]
 | 
				
			||||||
#[derive(Clone)]
 | 
					#[derive(Clone)]
 | 
				
			||||||
pub struct RationalBase where {
 | 
					pub struct RationalBase where {
 | 
				
			||||||
	pub val: Rational
 | 
						pub val: BigRational
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ToString for RationalBase{
 | 
					impl ToString for RationalBase{
 | 
				
			||||||
@@ -33,18 +35,12 @@ impl ToString for RationalBase{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl RationalBase {
 | 
					impl RationalBase {
 | 
				
			||||||
	pub fn from_frac(t: i64, b: i64) -> Option<RationalBase> {
 | 
						pub fn from_frac(t: i64, b: i64) -> Option<RationalBase> {
 | 
				
			||||||
		let v = Rational::from((t, b));
 | 
							let v = BigRational::new_raw(BigInt::from(t), BigInt::from(b));
 | 
				
			||||||
		return Some(RationalBase{ val: v });
 | 
							return Some(RationalBase{ val: v });
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl ScalarBase for RationalBase {
 | 
					impl ScalarBase for RationalBase {
 | 
				
			||||||
	fn from_f64(f: f64) -> Option<RationalBase> {
 | 
					 | 
				
			||||||
		let v = Rational::from_f64(f);
 | 
					 | 
				
			||||||
		if v.is_none() { return None }
 | 
					 | 
				
			||||||
		return Some(RationalBase{ val: v.unwrap() });
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	fn from_string(s: &str) -> Option<RationalBase> {
 | 
						fn from_string(s: &str) -> Option<RationalBase> {
 | 
				
			||||||
		// Scientific notation
 | 
							// Scientific notation
 | 
				
			||||||
		let mut sci = s.split("e");
 | 
							let mut sci = s.split("e");
 | 
				
			||||||
@@ -89,7 +85,7 @@ impl ScalarBase for RationalBase {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// From fraction string
 | 
							// From fraction string
 | 
				
			||||||
		let r = Rational::from_str_radix(&s, 10);
 | 
							let r = BigRational::from_str_radix(&s, 10);
 | 
				
			||||||
		let r = match r {
 | 
							let r = match r {
 | 
				
			||||||
			Ok(x) => x,
 | 
								Ok(x) => x,
 | 
				
			||||||
			Err(_) => return None
 | 
								Err(_) => return None
 | 
				
			||||||
@@ -100,18 +96,13 @@ impl ScalarBase for RationalBase {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn fract(&self) -> Option<RationalBase> {
 | 
						fn fract(&self) -> Option<RationalBase> { Some(RationalBase{val: self.val.fract()}) }
 | 
				
			||||||
		Some(RationalBase{val: self.val.clone().fract_floor(Integer::new()).0})
 | 
						fn is_int(&self) -> bool { self.val.is_integer() }
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn is_int(&self) -> bool {
 | 
						fn is_zero(&self) -> bool {self.val == BigRational::from_integer(BigInt::from(0))}
 | 
				
			||||||
		self.fract() == RationalBase::from_f64(0f64)
 | 
						fn is_one(&self) -> bool {self.val == BigRational::from_integer(BigInt::from(1))}
 | 
				
			||||||
	}
 | 
						fn is_negative(&self) -> bool { self.val.is_negative() }
 | 
				
			||||||
 | 
						fn is_positive(&self) -> bool { self.val.is_positive() }
 | 
				
			||||||
	fn is_zero(&self) -> bool {self.val == Rational::from((0,1))}
 | 
					 | 
				
			||||||
	fn is_one(&self) -> bool {self.val == Rational::from((1,1))}
 | 
					 | 
				
			||||||
	fn is_negative(&self) -> bool { self.val.clone().signum() == -1 }
 | 
					 | 
				
			||||||
	fn is_positive(&self) -> bool { self.val.clone().signum() == 1 }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn abs(&self) -> Option<RationalBase> {Some(RationalBase{val: self.val.clone().abs()})}
 | 
						fn abs(&self) -> Option<RationalBase> {Some(RationalBase{val: self.val.clone().abs()})}
 | 
				
			||||||
	fn floor(&self) -> Option<RationalBase> {Some(RationalBase{val: self.val.clone().floor()})}
 | 
						fn floor(&self) -> Option<RationalBase> {Some(RationalBase{val: self.val.clone().floor()})}
 | 
				
			||||||
@@ -153,9 +144,7 @@ impl Add for RationalBase where {
 | 
				
			|||||||
	type Output = Self;
 | 
						type Output = Self;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn add(self, other: Self) -> Self::Output {
 | 
						fn add(self, other: Self) -> Self::Output {
 | 
				
			||||||
		Self {
 | 
							Self { val: self.val + other.val }
 | 
				
			||||||
			val: self.val + other.val
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -169,9 +158,7 @@ impl Sub for RationalBase {
 | 
				
			|||||||
	type Output = Self;
 | 
						type Output = Self;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn sub(self, other: Self) -> Self::Output {
 | 
						fn sub(self, other: Self) -> Self::Output {
 | 
				
			||||||
		Self {
 | 
							Self { val: self.val - other.val }
 | 
				
			||||||
			val: self.val - other.val
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -185,9 +172,7 @@ impl Mul for RationalBase {
 | 
				
			|||||||
	type Output = Self;
 | 
						type Output = Self;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn mul(self, other: Self) -> Self::Output {
 | 
						fn mul(self, other: Self) -> Self::Output {
 | 
				
			||||||
		Self {
 | 
							Self { val: self.val * other.val }
 | 
				
			||||||
			val: self.val * other.val
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -201,9 +186,7 @@ impl Div for RationalBase {
 | 
				
			|||||||
	type Output = Self;
 | 
						type Output = Self;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn div(self, other: Self) -> Self::Output {
 | 
						fn div(self, other: Self) -> Self::Output {
 | 
				
			||||||
		Self {
 | 
							Self { val: self.val / other.val }
 | 
				
			||||||
			val: self.val / other.val
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,9 +200,7 @@ impl Neg for RationalBase where {
 | 
				
			|||||||
	type Output = Self;
 | 
						type Output = Self;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn neg(self) -> Self::Output {
 | 
						fn neg(self) -> Self::Output {
 | 
				
			||||||
		Self {
 | 
							Self { val: -self.val }
 | 
				
			||||||
			val: -self.val
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -228,15 +209,15 @@ impl Rem<RationalBase> for RationalBase {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	fn rem(self, modulus: RationalBase) -> Self::Output {
 | 
						fn rem(self, modulus: RationalBase) -> Self::Output {
 | 
				
			||||||
		if {
 | 
							if {
 | 
				
			||||||
			*self.val.denom() != 1 ||
 | 
								*self.val.denom() != BigInt::from(1) ||
 | 
				
			||||||
			*modulus.val.denom() != 1
 | 
								*modulus.val.denom() != BigInt::from(1)
 | 
				
			||||||
		} { panic!() }
 | 
							} { panic!() }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		RationalBase{
 | 
							RationalBase{
 | 
				
			||||||
			val : Rational::from((
 | 
								val : BigRational::new_raw(
 | 
				
			||||||
				self.val.numer() % modulus.val.numer(),
 | 
									self.val.numer() % modulus.val.numer(),
 | 
				
			||||||
				1
 | 
									BigInt::from(1)
 | 
				
			||||||
			))
 | 
								)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@ use std::ops::{
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
use std::cmp::Ordering;
 | 
					use std::cmp::Ordering;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use super::floatbase::FloatBase as FloatBase;
 | 
					use super::FloatBase as FloatBase;
 | 
				
			||||||
use super::rationalbase::RationalBase;
 | 
					use super::rationalbase::RationalBase;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,7 +21,6 @@ pub trait ScalarBase:
 | 
				
			|||||||
	PartialEq + PartialOrd
 | 
						PartialEq + PartialOrd
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// Creation
 | 
						// Creation
 | 
				
			||||||
	fn from_f64(f: f64) -> Option<Self>;
 | 
					 | 
				
			||||||
	fn from_string(s: &str) -> Option<Self>;
 | 
						fn from_string(s: &str) -> Option<Self>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Utility
 | 
						// Utility
 | 
				
			||||||
@@ -87,8 +86,8 @@ fn to_float(r: Scalar) -> Scalar {
 | 
				
			|||||||
	match &r {
 | 
						match &r {
 | 
				
			||||||
		Scalar::Float {..} => r,
 | 
							Scalar::Float {..} => r,
 | 
				
			||||||
		Scalar::Rational {v} => wrap_float!(
 | 
							Scalar::Rational {v} => wrap_float!(
 | 
				
			||||||
			FloatBase::from(v.val.numer()).unwrap() /
 | 
								FloatBase::from_string(&v.val.numer().to_string()).unwrap() /
 | 
				
			||||||
			FloatBase::from(v.val.denom()).unwrap()
 | 
								FloatBase::from_string(&v.val.denom().to_string()).unwrap()
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -105,13 +104,13 @@ impl ToString for Scalar {
 | 
				
			|||||||
// Creation methods
 | 
					// Creation methods
 | 
				
			||||||
impl Scalar {
 | 
					impl Scalar {
 | 
				
			||||||
	pub fn new_float(f: f64) -> Option<Self> {
 | 
						pub fn new_float(f: f64) -> Option<Self> {
 | 
				
			||||||
		let v = FloatBase::from_f64(f);
 | 
							let v = FloatBase::from_string(&f.to_string());
 | 
				
			||||||
		if v.is_none() { return None; }
 | 
							if v.is_none() { return None; }
 | 
				
			||||||
		return Some(wrap_float!(v.unwrap()));
 | 
							return Some(wrap_float!(v.unwrap()));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pub fn new_rational(f: f64) -> Option<Self> {
 | 
						pub fn new_rational(f: f64) -> Option<Self> {
 | 
				
			||||||
		let r = RationalBase::from_f64(f);
 | 
							let r = RationalBase::from_string(&f.to_string());
 | 
				
			||||||
		if r.is_none() { return None; }
 | 
							if r.is_none() { return None; }
 | 
				
			||||||
		return Some(wrap_rational!(r.unwrap()));
 | 
							return Some(wrap_rational!(r.unwrap()));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -186,7 +185,7 @@ impl Scalar {
 | 
				
			|||||||
	pub fn is_nan(&self) -> bool {
 | 
						pub fn is_nan(&self) -> bool {
 | 
				
			||||||
		match self {
 | 
							match self {
 | 
				
			||||||
			Scalar::Float{ v } => {v.val.is_nan()},
 | 
								Scalar::Float{ v } => {v.val.is_nan()},
 | 
				
			||||||
			Scalar::Rational {..} => {panic!()}
 | 
								Scalar::Rational {..} => {false}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -275,7 +275,6 @@ impl Unit {
 | 
				
			|||||||
		let mut q = Quantity::new_rational(1f64).unwrap();
 | 
							let mut q = Quantity::new_rational(1f64).unwrap();
 | 
				
			||||||
		q.set_unit(b);
 | 
							q.set_unit(b);
 | 
				
			||||||
		return Some(q);
 | 
							return Some(q);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								src/tests.rs
									
									
									
									
									
								
							
							
						
						@@ -1,7 +1,7 @@
 | 
				
			|||||||
// Many of these have been borrowed from insect.
 | 
					// Many of these have been borrowed from insect.
 | 
				
			||||||
use crate::parser;
 | 
					use daisycalc::parser;
 | 
				
			||||||
use crate::evaluate::evaluate;
 | 
					use daisycalc::evaluate;
 | 
				
			||||||
use crate::context::Context;
 | 
					use daisycalc::Context;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn eval_to_str(s: &str) -> Result<String, ()> {
 | 
					fn eval_to_str(s: &str) -> Result<String, ()> {
 | 
				
			||||||
	let g = match parser::parse_no_context(&String::from(s)) {
 | 
						let g = match parser::parse_no_context(&String::from(s)) {
 | 
				
			||||||
@@ -131,7 +131,7 @@ fn operators() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	good_expr("125", "5^(+3)");
 | 
						good_expr("125", "5^(+3)");
 | 
				
			||||||
	good_expr("125", "+5^3");
 | 
						good_expr("125", "+5^3");
 | 
				
			||||||
	good_expr("0.2148", "3 ^ (-1.4)");
 | 
						good_expr("0.21479", "3 ^ (-1.4)");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Should parse as ((2^3)^4)^5
 | 
						// Should parse as ((2^3)^4)^5
 | 
				
			||||||
	good_expr("1.1529e18", "2^3^4^5");
 | 
						good_expr("1.1529e18", "2^3^4^5");
 | 
				
			||||||
@@ -162,6 +162,7 @@ fn operators() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	good_expr("2", "6/3");
 | 
						good_expr("2", "6/3");
 | 
				
			||||||
	good_expr("2", "5%3");
 | 
						good_expr("2", "5%3");
 | 
				
			||||||
 | 
						good_expr("4", "2^5 mod 7");
 | 
				
			||||||
	good_expr("8", "5+3");
 | 
						good_expr("8", "5+3");
 | 
				
			||||||
	good_expr("64", "4^3");
 | 
						good_expr("64", "4^3");
 | 
				
			||||||
	good_expr("64", "4 ^ 3");
 | 
						good_expr("64", "4 ^ 3");
 | 
				
			||||||
@@ -184,6 +185,7 @@ fn operators() {
 | 
				
			|||||||
	bad_expr("1e5!");
 | 
						bad_expr("1e5!");
 | 
				
			||||||
	bad_expr("0^(-1)");
 | 
						bad_expr("0^(-1)");
 | 
				
			||||||
	bad_expr("pi!");
 | 
						bad_expr("pi!");
 | 
				
			||||||
 | 
						bad_expr("2.5 mod 8");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[test]
 | 
					#[test]
 | 
				
			||||||
 
 | 
				
			|||||||