Skip to content

Commit

Permalink
Finishing release 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WeirdConstructor committed Sep 12, 2019
1 parent 4777ff8 commit 9ad1918
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
0.2.3 (unreleased)
=================
0.3.0 (2019-09-13)
==================

* Incompatible Change: Removed :wref and :ref definition labels in favor of
proper $&&, $& and $\* reference handling. Added `wl:weaken` and `wl:set_ref` and
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wlambda"
version = "0.2.2"
version = "0.3.0"
authors = ["Weird Constructor <[email protected]>"]
license = "GPL-3.0-or-later"
edition = "2018"
Expand Down
4 changes: 2 additions & 2 deletions examples/random_syntax_stuff.wl
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ $q" fefei fwof w
"

feoofw@fe(fei)
feoofw@fe[fei]
_d

:foo :ba@fo_-
:"fo @ [] \xFFAA { \u39f9e \t \r \n \" \0 \x00 } fe"
$e foobar [ 120 3 ]
$e foobar ( 120 3 )
panic "foobar" $t $true 3023 403.439 -32 +32 $n $nul
$b"feofeo"
while foo
Expand Down
6 changes: 3 additions & 3 deletions src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,9 +1092,9 @@ pub fn create_wlamba_prelude() -> GlobalEnvRef {
Ok(VVal::new_byt(
s.chars()
.map(|c|
match c { '0'..='9' => ( 9 - (('9' as u8) - (c as u8))) as i16,
'a'..='f' => (15 - (('f' as u8) - (c as u8))) as i16,
'A'..='F' => (15 - (('F' as u8) - (c as u8))) as i16,
match c { '0'..='9' => ( 9 - (b'9' - (c as u8))) as i16,
'a'..='f' => (15 - (b'f' - (c as u8))) as i16,
'A'..='F' => (15 - (b'F' - (c as u8))) as i16,
_ => -1 })
.fold((256, out), |(last, mut out), c: i16|
if c == -1 { (last, out) }
Expand Down
17 changes: 13 additions & 4 deletions src/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,13 @@ enum RecvState {
Return,
}

type RecvData = (RecvState, String, Vec<u8>, bool, VecDeque<(String, Vec<u8>)>);
type RecvMutex = Mutex<RecvData>;

#[derive(Debug)]
#[cfg(feature="rmp-serde")]
pub struct Receiver {
mx: Mutex<(RecvState, String, Vec<u8>, bool, VecDeque<(String, Vec<u8>)>)>,
mx: RecvMutex,
cv: Condvar,
}

Expand All @@ -271,7 +274,7 @@ impl Receiver {
}

#[cfg(feature="rmp-serde")]
fn mx_recv_error(mx: &mut (RecvState, String, Vec<u8>, bool, VecDeque<(String, Vec<u8>)>), s: &str) {
fn mx_recv_error(mx: &mut RecvData, s: &str) {
mx.0 = RecvState::Return;
mx.2 =
VVal::err_msg(&format!("return value serialization error: {}", s))
Expand All @@ -281,7 +284,7 @@ fn mx_recv_error(mx: &mut (RecvState, String, Vec<u8>, bool, VecDeque<(String, V
}

#[cfg(feature="rmp-serde")]
fn mx_return(mx: &mut (RecvState, String, Vec<u8>, bool, VecDeque<(String, Vec<u8>)>), v: &VVal) {
fn mx_return(mx: &mut RecvData, v: &VVal) {
mx.0 = RecvState::Return;
match v.to_msgpack() {
Ok(s) => {
Expand Down Expand Up @@ -394,7 +397,7 @@ impl MsgHandle {
std::mem::drop(mx);
loop {
let mut mx = r.mx.lock().unwrap();
if mx.4.len() <= 0 {
if mx.4.is_empty() {
mx.0 = RecvState::Open;
break;
}
Expand Down Expand Up @@ -429,6 +432,12 @@ impl MsgHandle {
}
}

impl Default for MsgHandle {
fn default() -> Self {
Self::new()
}
}

#[cfg(test)]
mod tests {
#[cfg(feature="rmp-serde")]
Expand Down
5 changes: 4 additions & 1 deletion src/vval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ impl VValFun {
/// assert_eq!(
/// r.s(), "$[98,$<MyType((14, 84))>]", "Userdata implementation works");
///```
#[allow(clippy::borrowed_box)]
pub trait VValUserData {
/// This method should return a human readable syntax representation
/// of your VValUserData.
Expand Down Expand Up @@ -961,7 +962,7 @@ impl VVal {
VVal::Byt(s) => { if let VVal::Byt(s2) = v { s.borrow()[..] == s2.borrow()[..] } else { false } },
VVal::Usr(u) => {
if let VVal::Usr(u2) = v {
u.eqv(u2)
u.eqv(&u2)
} else {
false
}
Expand Down Expand Up @@ -1129,6 +1130,8 @@ impl VVal {
self
}

pub fn is_empty(&self) -> bool { self.len() == 0 }

pub fn len(&self) -> usize {
match self {
VVal::Lst(l) => l.borrow().len(),
Expand Down

0 comments on commit 9ad1918

Please sign in to comment.