mirror of
https://github.com/Z3Prover/z3
synced 2025-07-19 10:52:02 +00:00
Reorganizing the code. Moved nlsat to its own directory.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
c66b9ab615
commit
9a84cba6c9
22 changed files with 3 additions and 2 deletions
45
src/ast/for_each_ast.cpp
Normal file
45
src/ast/for_each_ast.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*++
|
||||
Copyright (c) 2006 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
for_each_ast.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
For each ast visitor
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2006-10-18.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
|
||||
#include"for_each_ast.h"
|
||||
|
||||
struct ast_counter_proc {
|
||||
unsigned m_num;
|
||||
ast_counter_proc():m_num(0) {}
|
||||
void operator()(ast *) { m_num++; }
|
||||
};
|
||||
|
||||
unsigned get_num_nodes(ast * n) {
|
||||
for_each_ast_proc<ast_counter_proc> counter;
|
||||
for_each_ast(counter, n);
|
||||
return counter.m_num;
|
||||
}
|
||||
|
||||
|
||||
bool for_each_parameter(ptr_vector<ast> & stack, ast_mark & visited, unsigned num_args, parameter const * params) {
|
||||
bool result = true;
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
parameter const& p = params[i];
|
||||
if (p.is_ast() && !visited.is_marked(p.get_ast())) {
|
||||
stack.push_back(p.get_ast());
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue