Compare commits
No commits in common. "5478e5e40e802e0a505244739332393e9d2e97fe" and "c62b5c903dbd2f216b08b9e41cef0283c4da503c" have entirely different histories.
5478e5e40e
...
c62b5c903d
0
pkg/.gitignore
vendored
0
pkg/.gitignore
vendored
3
pkg/README.md
Normal file
3
pkg/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# rudus
|
||||||
|
|
||||||
|
A Rust implementation of Ludus.
|
15
pkg/package.json
Normal file
15
pkg/package.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "rudus",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"files": [
|
||||||
|
"rudus_bg.wasm",
|
||||||
|
"rudus.js",
|
||||||
|
"rudus.d.ts"
|
||||||
|
],
|
||||||
|
"main": "rudus.js",
|
||||||
|
"types": "rudus.d.ts",
|
||||||
|
"sideEffects": [
|
||||||
|
"./snippets/*"
|
||||||
|
]
|
||||||
|
}
|
5
pkg/test.js
Normal file
5
pkg/test.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import * as mod from "./ludus.js";
|
||||||
|
|
||||||
|
console.log(mod.run(`
|
||||||
|
:foobar
|
||||||
|
`));
|
|
@ -3,7 +3,7 @@ use crate::value::Value;
|
||||||
use crate::vm::{Creature, Panic};
|
use crate::vm::{Creature, Panic};
|
||||||
use ran::ran_u8;
|
use ran::ran_u8;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::HashMap;
|
||||||
use std::mem::swap;
|
use std::mem::swap;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -67,7 +67,7 @@ pub struct Zoo {
|
||||||
procs: Vec<Status>,
|
procs: Vec<Status>,
|
||||||
empty: Vec<usize>,
|
empty: Vec<usize>,
|
||||||
ids: HashMap<&'static str, usize>,
|
ids: HashMap<&'static str, usize>,
|
||||||
dead: HashSet<&'static str>,
|
dead: Vec<&'static str>,
|
||||||
kill_list: Vec<&'static str>,
|
kill_list: Vec<&'static str>,
|
||||||
sleeping: HashMap<&'static str, (Instant, Duration)>,
|
sleeping: HashMap<&'static str, (Instant, Duration)>,
|
||||||
active_idx: usize,
|
active_idx: usize,
|
||||||
|
@ -81,7 +81,7 @@ impl Zoo {
|
||||||
empty: vec![],
|
empty: vec![],
|
||||||
ids: HashMap::new(),
|
ids: HashMap::new(),
|
||||||
kill_list: vec![],
|
kill_list: vec![],
|
||||||
dead: HashSet::new(),
|
dead: vec![],
|
||||||
sleeping: HashMap::new(),
|
sleeping: HashMap::new(),
|
||||||
active_idx: 0,
|
active_idx: 0,
|
||||||
active_id: "",
|
active_id: "",
|
||||||
|
@ -155,7 +155,7 @@ impl Zoo {
|
||||||
self.procs[*idx] = Status::Empty;
|
self.procs[*idx] = Status::Empty;
|
||||||
self.empty.push(*idx);
|
self.empty.push(*idx);
|
||||||
self.ids.remove(id);
|
self.ids.remove(id);
|
||||||
self.dead.insert(id);
|
self.dead.push(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user