mirror of https://github.com/vitalif/openscad
Removed old stack measurement code
parent
15835271c2
commit
f1b29e1db9
|
@ -49,7 +49,7 @@ static bool is_config_variable(const std::string &name) {
|
|||
created, and all children will share the root parent's stack.
|
||||
*/
|
||||
Context::Context(const Context *parent)
|
||||
: parent(parent), stack_ptr(0), stack_max(0)
|
||||
: parent(parent)
|
||||
{
|
||||
if (parent) {
|
||||
assert(parent->ctx_stack && "Parent context stack was null!");
|
||||
|
@ -70,49 +70,6 @@ Context::~Context()
|
|||
if (!parent) delete this->ctx_stack;
|
||||
}
|
||||
|
||||
unsigned long Context::stackUsage() const
|
||||
{
|
||||
if (parent == NULL) {
|
||||
unsigned long ret = std::labs((unsigned long)stack_ptr - (unsigned long)stack_max);
|
||||
((Context *)this)->stack_ptr = 0;
|
||||
((Context *)this)->stack_max = 0;
|
||||
return ret;
|
||||
} else {
|
||||
return parent->stackUsage();
|
||||
}
|
||||
}
|
||||
|
||||
bool Context::setStack(const void* stack_cur) const
|
||||
{
|
||||
if (parent == NULL) {
|
||||
bool ret = this->stack_ptr == 0;
|
||||
if (ret) {
|
||||
((Context *)this)->stack_ptr = stack_cur;
|
||||
((Context *)this)->stack_max = stack_cur;
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
return parent->setStack(stack_cur);
|
||||
}
|
||||
}
|
||||
|
||||
void Context::checkStack(const void *stack_cur) const
|
||||
{
|
||||
if (parent == NULL) {
|
||||
if (stack_cur < this->stack_ptr) {
|
||||
if (stack_cur < this->stack_max) {
|
||||
((Context *)this)->stack_max = stack_cur;
|
||||
}
|
||||
} else {
|
||||
if (stack_cur > this->stack_max) {
|
||||
((Context *)this)->stack_max = stack_cur;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
parent->checkStack(stack_cur);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Initialize context from a module argument list and a evaluation context
|
||||
which may pass variables which will be preferred over default values.
|
||||
|
|
|
@ -33,17 +33,11 @@ public:
|
|||
const std::string &documentPath() const { return this->document_path; }
|
||||
std::string getAbsolutePath(const std::string &filename) const;
|
||||
|
||||
unsigned long stackUsage() const;
|
||||
bool setStack(const void *stack_cur) const;
|
||||
void checkStack(const void *stack_cur) const;
|
||||
|
||||
public:
|
||||
|
||||
protected:
|
||||
const Context *parent;
|
||||
Stack *ctx_stack;
|
||||
const void *stack_ptr;
|
||||
const void *stack_max;
|
||||
|
||||
typedef boost::unordered_map<std::string, ValuePtr> ValueMap;
|
||||
ValueMap constants;
|
||||
|
|
Loading…
Reference in New Issue