--- parser3/src/include/pa_stack.h 2019/12/05 22:21:16 1.30 +++ parser3/src/include/pa_stack.h 2026/04/25 13:38:46 1.35 @@ -1,14 +1,14 @@ /** @file Parser: stack class decl. - Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) - Author: Alexandr Petrosian (http://paf.design.ru) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef PA_STACK_H #define PA_STACK_H -#define IDENT_PA_STACK_H "$Id: pa_stack.h,v 1.30 2019/12/05 22:21:16 moko Exp $" +#define IDENT_PA_STACK_H "$Id: pa_stack.h,v 1.35 2026/04/25 13:38:46 moko Exp $" #include "pa_array.h" @@ -21,25 +21,25 @@ public: inline void push(T item) { if(this->is_full()) expand(this->fallocated); // free is not called, so expanding a lot to decrease memory waste - this->felements[this->fused++]=item; + this->felements[this->fsize++]=item; } inline T pop() { - return this->felements[--this->fused]; + return this->felements[--this->fsize]; } - inline bool is_empty() { return this->fused==0; } - inline size_t top_index() { return this->fused; } - inline void set_top_index(size_t atop) { this->fused=atop; } + inline bool is_empty() { return this->fsize==0; } + inline size_t top_index() { return this->fsize; } + inline void set_top_index(size_t atop) { this->fsize=atop; } inline T top_value() { assert(!is_empty()); - return this->felements[this->fused-1]; + return this->felements[this->fsize-1]; } /// call this prior to collecting garbage [in unused part of stack there may be pointers(unused)] void wipe_unused() { - if(size_t above_top_size=this->fallocated-this->fused) - memset((void *)&this->felements[this->fused], 0, above_top_size*sizeof(T)); + if(size_t above_top_size=this->fallocated-this->fsize) + memset((void *)&this->felements[this->fsize], 0, above_top_size*sizeof(T)); } protected: