Changeset - b826e300c566
[Not reviewed]
0 6 0
Christopher Esterhuyse - 5 years ago 2020-07-28 09:58:50
christopher.esterhuyse@gmail.com
cleaned up warnings
6 files changed with 55 insertions and 62 deletions:
0 comments (0 inline, 0 general)
Cargo.toml
Show inline comments
 
@@ -41,7 +41,7 @@ lazy_static = "1.4.0"
 
crate-type = ["cdylib"]
 

	
 
[features]
 
default = ["ffi", "session_optimization", "ffi_pseudo_socket_api"]
 
default = ["ffi", "session_optimization"]
 
ffi = [] # see src/ffi/mod.rs
 
ffi_pseudo_socket_api = ["ffi", "libc", "os_socketaddr"]# see src/ffi/pseudo_socket_api.rs
 
endpoint_logging = [] # see src/macros.rs
reowolf.h
Show inline comments
 
@@ -47,9 +47,7 @@ typedef uint32_t U32Suffix;
 
typedef struct {
 
  ConnectorId connector_id;
 
  U32Suffix u32_suffix;
 
} Id;
 

	
 
typedef Id PortId;
 
} PortId;
 

	
 
typedef struct {
 
  uint8_t ipv4[4];
src/protocol/ast.rs
Show inline comments
 
@@ -2099,27 +2099,27 @@ impl Statement {
 
    }
 
    pub fn link_next(&mut self, next: StatementId) {
 
        match self {
 
            Statement::Block(stmt) => panic!(),
 
            Statement::Block(_) => todo!(),
 
            Statement::Local(stmt) => match stmt {
 
                LocalStatement::Channel(stmt) => stmt.next = Some(next),
 
                LocalStatement::Memory(stmt) => stmt.next = Some(next),
 
            },
 
            Statement::Skip(stmt) => stmt.next = Some(next),
 
            Statement::Labeled(stmt) => panic!(),
 
            Statement::If(stmt) => panic!(),
 
            Statement::EndIf(stmt) => stmt.next = Some(next),
 
            Statement::While(stmt) => panic!(), // although while has a next field, it is linked manually
 
            Statement::EndWhile(stmt) => stmt.next = Some(next),
 
            Statement::Break(stmt) => panic!(),
 
            Statement::Continue(stmt) => panic!(),
 
            Statement::Synchronous(stmt) => panic!(),
 
            Statement::EndSynchronous(stmt) => stmt.next = Some(next),
 
            Statement::Return(stmt) => panic!(),
 
            Statement::Assert(stmt) => stmt.next = Some(next),
 
            Statement::Goto(stmt) => panic!(),
 
            Statement::New(stmt) => stmt.next = Some(next),
 
            Statement::Put(stmt) => stmt.next = Some(next),
 
            Statement::Expression(stmt) => stmt.next = Some(next),
 
            Statement::Return(_)
 
            | Statement::Break(_)
 
            | Statement::Continue(_)
 
            | Statement::Synchronous(_)
 
            | Statement::Goto(_)
 
            | Statement::While(_)
 
            | Statement::Labeled(_)
 
            | Statement::If(_) => unreachable!(),
 
        }
 
    }
 
}
src/protocol/eval.rs
Show inline comments
 
@@ -1558,7 +1558,7 @@ impl Store {
 
                Ok(value)
 
            }
 
            Expression::Indexing(expr) => self.get(h, ctx, expr.this.upcast()),
 
            Expression::Slicing(expr) => unimplemented!(),
 
            Expression::Slicing(_expr) => unimplemented!(),
 
            Expression::Select(expr) => self.get(h, ctx, expr.this.upcast()),
 
            Expression::Array(expr) => {
 
                let mut elements = Vec::new();
 
@@ -1590,7 +1590,7 @@ impl Store {
 
                        Some(result) => Ok(result),
 
                    }
 
                }
 
                Method::Symbolic(symbol) => unimplemented!(),
 
                Method::Symbolic(_symbol) => unimplemented!(),
 
            },
 
            Expression::Variable(expr) => self.get(h, ctx, expr.this.upcast()),
 
        }
 
@@ -1771,37 +1771,36 @@ impl Prompt {
 
            }
 
            Statement::Expression(stmt) => {
 
                // Evaluate expression
 
                let value = self.store.eval(h, ctx, stmt.expression)?;
 
                let _value = self.store.eval(h, ctx, stmt.expression)?;
 
                // Continue to next statement
 
                self.position = stmt.next;
 
                Err(EvalContinuation::Stepping)
 
            }
 
        }
 
    }
 
    fn compute_function(_h: &Heap, _fun: FunctionId, _args: &Vec<Value>) -> Option<Value> {
 
        todo!()
 
        // let mut prompt = Self::new(h, fun.upcast(), args);
 
        // let mut context = EvalContext::None;
 
        // loop {
 
        //     let result = prompt.step(h, &mut context);
 
        //     match result {
 
        //         Ok(val) => return Some(val),
 
        //         Err(cont) => match cont {
 
        //             EvalContinuation::Stepping => continue,
 
        //             EvalContinuation::Inconsistent => return None,
 
        //             // Functions never terminate without returning
 
        //             EvalContinuation::Terminal => unreachable!(),
 
        //             // Functions never encounter any blocking behavior
 
        //             EvalContinuation::SyncBlockStart => unreachable!(),
 
        //             EvalContinuation::SyncBlockEnd => unreachable!(),
 
        //             EvalContinuation::NewComponent(_, _) => unreachable!(),
 
        //             EvalContinuation::BlockFires(val) => unreachable!(),
 
        //             EvalContinuation::BlockGet(val) => unreachable!(),
 
        //             EvalContinuation::Put(port, msg) => unreachable!(),
 
        //         },
 
        //     }
 
        // }
 
    }
 
    // fn compute_function(_h: &Heap, _fun: FunctionId, _args: &Vec<Value>) -> Option<Value> {
 
    // let mut prompt = Self::new(h, fun.upcast(), args);
 
    // let mut context = EvalContext::None;
 
    // loop {
 
    //     let result = prompt.step(h, &mut context);
 
    //     match result {
 
    //         Ok(val) => return Some(val),
 
    //         Err(cont) => match cont {
 
    //             EvalContinuation::Stepping => continue,
 
    //             EvalContinuation::Inconsistent => return None,
 
    //             // Functions never terminate without returning
 
    //             EvalContinuation::Terminal => unreachable!(),
 
    //             // Functions never encounter any blocking behavior
 
    //             EvalContinuation::SyncBlockStart => unreachable!(),
 
    //             EvalContinuation::SyncBlockEnd => unreachable!(),
 
    //             EvalContinuation::NewComponent(_, _) => unreachable!(),
 
    //             EvalContinuation::BlockFires(val) => unreachable!(),
 
    //             EvalContinuation::BlockGet(val) => unreachable!(),
 
    //             EvalContinuation::Put(port, msg) => unreachable!(),
 
    //         },
 
    //     }
 
    // }
 
    // }
 
}
 

	
 
// #[cfg(test)]
src/protocol/parser.rs
Show inline comments
 
@@ -294,19 +294,19 @@ fn recursive_statement<T: Visitor>(this: &mut T, h: &mut Heap, stmt: StatementId
 
        Statement::Skip(stmt) => this.visit_skip_statement(h, stmt.this),
 
        Statement::Labeled(stmt) => this.visit_labeled_statement(h, stmt.this),
 
        Statement::If(stmt) => this.visit_if_statement(h, stmt.this),
 
        Statement::EndIf(stmt) => unreachable!(), // pseudo-statement
 
        Statement::While(stmt) => this.visit_while_statement(h, stmt.this),
 
        Statement::EndWhile(stmt) => unreachable!(), // pseudo-statement
 
        Statement::Break(stmt) => this.visit_break_statement(h, stmt.this),
 
        Statement::Continue(stmt) => this.visit_continue_statement(h, stmt.this),
 
        Statement::Synchronous(stmt) => this.visit_synchronous_statement(h, stmt.this),
 
        Statement::EndSynchronous(stmt) => unreachable!(), // pseudo-statement
 
        Statement::Return(stmt) => this.visit_return_statement(h, stmt.this),
 
        Statement::Assert(stmt) => this.visit_assert_statement(h, stmt.this),
 
        Statement::Goto(stmt) => this.visit_goto_statement(h, stmt.this),
 
        Statement::New(stmt) => this.visit_new_statement(h, stmt.this),
 
        Statement::Put(stmt) => this.visit_put_statement(h, stmt.this),
 
        Statement::Expression(stmt) => this.visit_expression_statement(h, stmt.this),
 
        Statement::EndSynchronous(_) | Statement::EndWhile(_) | Statement::EndIf(_) => {
 
            unreachable!() // pseudo-statement
 
        }
 
    }
 
}
 

	
 
@@ -796,7 +796,7 @@ impl Visitor for BuildSymbolDeclarations {
 
        h[pd].declarations.append(&mut self.declarations);
 
        Ok(())
 
    }
 
    fn visit_import(&mut self, h: &mut Heap, import: ImportId) -> VisitorResult {
 
    fn visit_import(&mut self, _h: &mut Heap, _import: ImportId) -> VisitorResult {
 
        todo!()
 
        // let vec = library::get_declarations(h, import)?;
 
        // // Destructively iterate over the vector
 
@@ -926,7 +926,7 @@ impl Visitor for BuildScope {
 
        self.scope = old;
 
        Ok(())
 
    }
 
    fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult {
 
    fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult {
 
        Ok(())
 
    }
 
}
 
@@ -1007,7 +1007,7 @@ impl Visitor for ResolveVariables {
 
        recursive_memory_statement(self, h, stmt)?;
 
        // Finally, we may add the variable to the scope, which is guaranteed to be a block
 
        {
 
            let mut block = &mut h[self.scope.unwrap().to_block()];
 
            let block = &mut h[self.scope.unwrap().to_block()];
 
            block.locals.push(var);
 
        }
 
        Ok(())
 
@@ -1022,7 +1022,7 @@ impl Visitor for ResolveVariables {
 
            if check_duplicate.is_some() {
 
                return Err(ParseError::new(h[id].position, "Declared variable clash"));
 
            }
 
            let mut block = &mut h[self.scope.unwrap().to_block()];
 
            let block = &mut h[self.scope.unwrap().to_block()];
 
            block.locals.push(var);
 
        }
 
        // Then handle the to variable (which may not be the same as the from)
 
@@ -1033,7 +1033,7 @@ impl Visitor for ResolveVariables {
 
            if check_duplicate.is_some() {
 
                return Err(ParseError::new(h[id].position, "Declared variable clash"));
 
            }
 
            let mut block = &mut h[self.scope.unwrap().to_block()];
 
            let block = &mut h[self.scope.unwrap().to_block()];
 
            block.locals.push(var);
 
        }
 
        Ok(())
 
@@ -1179,33 +1179,33 @@ impl Visitor for LinkStatements {
 
        self.prev = Some(UniqueStatementId(pseudo));
 
        Ok(())
 
    }
 
    fn visit_return_statement(&mut self, h: &mut Heap, stmt: ReturnStatementId) -> VisitorResult {
 
    fn visit_return_statement(&mut self, _h: &mut Heap, _stmt: ReturnStatementId) -> VisitorResult {
 
        Ok(())
 
    }
 
    fn visit_assert_statement(&mut self, h: &mut Heap, stmt: AssertStatementId) -> VisitorResult {
 
    fn visit_assert_statement(&mut self, _h: &mut Heap, stmt: AssertStatementId) -> VisitorResult {
 
        self.prev = Some(UniqueStatementId(stmt.upcast()));
 
        Ok(())
 
    }
 
    fn visit_goto_statement(&mut self, _h: &mut Heap, _stmt: GotoStatementId) -> VisitorResult {
 
        Ok(())
 
    }
 
    fn visit_new_statement(&mut self, h: &mut Heap, stmt: NewStatementId) -> VisitorResult {
 
    fn visit_new_statement(&mut self, _h: &mut Heap, stmt: NewStatementId) -> VisitorResult {
 
        self.prev = Some(UniqueStatementId(stmt.upcast()));
 
        Ok(())
 
    }
 
    fn visit_put_statement(&mut self, h: &mut Heap, stmt: PutStatementId) -> VisitorResult {
 
    fn visit_put_statement(&mut self, _h: &mut Heap, stmt: PutStatementId) -> VisitorResult {
 
        self.prev = Some(UniqueStatementId(stmt.upcast()));
 
        Ok(())
 
    }
 
    fn visit_expression_statement(
 
        &mut self,
 
        h: &mut Heap,
 
        _h: &mut Heap,
 
        stmt: ExpressionStatementId,
 
    ) -> VisitorResult {
 
        self.prev = Some(UniqueStatementId(stmt.upcast()));
 
        Ok(())
 
    }
 
    fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult {
 
    fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult {
 
        Ok(())
 
    }
 
}
 
@@ -1253,7 +1253,7 @@ impl Visitor for BuildLabels {
 
        self.sync_enclosure = None;
 
        Ok(())
 
    }
 
    fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult {
 
    fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult {
 
        Ok(())
 
    }
 
}
 
@@ -1436,7 +1436,7 @@ impl Visitor for ResolveLabels {
 
        h[stmt].target = Some(target);
 
        Ok(())
 
    }
 
    fn visit_expression(&mut self, h: &mut Heap, expr: ExpressionId) -> VisitorResult {
 
    fn visit_expression(&mut self, _h: &mut Heap, _expr: ExpressionId) -> VisitorResult {
 
        Ok(())
 
    }
 
}
 
@@ -1564,8 +1564,8 @@ impl Visitor for AssignableExpressions {
 
    }
 
    fn visit_variable_expression(
 
        &mut self,
 
        h: &mut Heap,
 
        expr: VariableExpressionId,
 
        _h: &mut Heap,
 
        _expr: VariableExpressionId,
 
    ) -> VisitorResult {
 
        Ok(())
 
    }
src/runtime/mod.rs
Show inline comments
 
@@ -625,10 +625,6 @@ impl SpecVal {
 
        self == Self::FIRING
 
        // all else treated as SILENT
 
    }
 
    fn nth_domain_element(n: usize) -> Self {
 
        let n: u16 = n.try_into().unwrap();
 
        SpecVal(n)
 
    }
 
    fn iter_domain() -> impl Iterator<Item = Self> {
 
        (0..).map(SpecVal)
 
    }
0 comments (0 inline, 0 general)