1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
#ifndef STACK_HPP
#define STACK_HPP 1

//
//  data structures
//

struct Stack_Element {
    double          value;
    Stack_Element   *last;
};

struct Stack {
    Stack_Element   *top;
};

//
//  public constructors and destructor
//

void
Stack_construct_default(Stackconst this_);

void
Stack_construct_copy(Stackconst this_, const Stackconst stack);

void
Stack_construct_swap(Stackconst this_, Stackconst stack);

void
Stack_destruct(Stackconst this_);

//
//  public methods
//

bool
Stack_isEmpty(const Stackconst this_);

Stackconst
Stack_assign(Stackconst this_, Stackconst stack);

void
Stack_push(Stackconst this_, double value);

double
Stack_pop(Stackconst this_);

void
Stack_print(Stackconst this_, const char *txt);

//
//  private methods
//

void
Stack_copy_elements_(Stackconst this_, const Stack_Element *element);

void
Stack_print_elements_(const Stackconst this_, const Stack_Element *element);

#endif // STACK_HPP