some prototype mini utils
This commit is contained in:
parent
e21b888b6c
commit
921377c2cc
6 changed files with 163 additions and 0 deletions
math/int2str
9
math/int2str/Cargo.toml
Normal file
9
math/int2str/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "int2str"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
nested = { path = "../../nested" }
|
38
math/int2str/src/main.rs
Normal file
38
math/int2str/src/main.rs
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
use std::{
|
||||
fs::File,
|
||||
io::{Read, Write},
|
||||
os::unix::io::FromRawFd
|
||||
};
|
||||
|
||||
fn main() {
|
||||
nested::magic_header();
|
||||
eprintln!(" Human-readably Print MachineInt");
|
||||
nested::magic_header();
|
||||
|
||||
let mut f0 = unsafe { File::from_raw_fd(0) };
|
||||
eprintln!("
|
||||
> 0:
|
||||
( ℕ )
|
||||
( MachineInt )
|
||||
( MachineWord )
|
||||
( Array 8 MachineSlab )
|
||||
( Pipe Shot (Array 8 MachineSlab) )
|
||||
");
|
||||
|
||||
eprintln!("
|
||||
< 1:
|
||||
( ℕ )
|
||||
( Sequence (Digit 10) )
|
||||
( Sequence ASCII )
|
||||
( Sequence MachineSlab )
|
||||
( Pipe Shot (Sequence MachineSlab) )
|
||||
");
|
||||
|
||||
nested::magic_header();
|
||||
|
||||
let mut bytes = [0 as u8; 8];
|
||||
f0.read_exact(&mut bytes);
|
||||
println!("{}", u64::from_le_bytes(bytes));
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue