Main Page | File List | Globals | Related Pages

stack.c File Reference

Module for the definition of the stack. More...

Go to the source code of this file.

Functions

Stack * stack_new (StackFP_Pop pop, StackFP_Push push)
void stack_construct (Stack *stack, StackFP_Pop pop, StackFP_Push push)
void stack_destroy (void *stack)
uint32_t stack_pop (Stack *stack, int bytes)
void stack_push (Stack *stack, int bytes, uint32_t val)
HWStack * hwstack_new (int depth)
void hwstack_construct (HWStack *stack, int depth)
void hwstack_destroy (void *stack)
MemStack * memstack_new (Memory *mem)
void memstack_construct (MemStack *stack, Memory *mem)
void memstack_destroy (void *stack)


Detailed Description

Module for the definition of the stack.

Defines the classes stack, hw_stack, and mem_stack.

FIXME: Ted, I would really really really love to put in a description of what is the difference between these three classes and how they're used, but I don't understand it myself.

Definition in file stack.c.


Function Documentation

Stack* stack_new StackFP_Pop  pop,
StackFP_Push  push
 

Allocates memory for a new Stack object.

This is a virtual method for higher level stack implementations and as such should not be used directly. Definition at line 81 of file stack.c.

References avr_new, class_overload_destroy(), stack_construct(), and stack_destroy().

void stack_construct Stack *  stack,
StackFP_Pop  pop,
StackFP_Push  push
 

Constructor for the Stack class.

This is a virtual method for higher level stack implementations and as such should not be used directly. Definition at line 98 of file stack.c.

References avr_error, and class_construct().

Referenced by hwstack_construct(), memstack_construct(), and stack_new().

void stack_destroy void *  stack  ) 
 

Destructor for the Stack class.

This is a virtual method for higher level stack implementations and as such should not be used directly. Definition at line 115 of file stack.c.

References class_destroy().

Referenced by hwstack_destroy(), memstack_destroy(), and stack_new().

uint32_t stack_pop Stack *  stack,
int  bytes
 

Pops a byte or a word off the stack and returns it.

Parameters:
stack A pointer to the Stack object from which to pop
bytes Number of bytes to pop off the stack (1 to 4 bytes).
Returns:
The 1 to 4 bytes value popped from the stack.
This method provides access to the derived class's pop() method. Definition at line 132 of file stack.c.

void stack_push Stack *  stack,
int  bytes,
uint32_t  val
 

Pushes a byte or a word of data onto the stack.

Parameters:
stack A pointer to the Stack object from which to pop.
bytes Size of the value being pushed onto the stack (1 to 4 bytes).
val The value to be pushed.
This method provides access to the derived class's push() method. Definition at line 145 of file stack.c.

HWStack* hwstack_new int  depth  ) 
 

Allocate a new HWStack object.

This is the stack implementation used by devices which lack SRAM and only have a fixed size hardware stack (e.i., the at90s1200) Definition at line 162 of file stack.c.

References avr_new, class_overload_destroy(), hwstack_construct(), and hwstack_destroy().

Referenced by avr_core_construct().

void hwstack_construct HWStack *  stack,
int  depth
 

Constructor for HWStack object.

Definition at line 176 of file stack.c.

References avr_error, avr_new0, and stack_construct().

Referenced by hwstack_new().

void hwstack_destroy void *  stack  ) 
 

Destructor for HWStack object.

Definition at line 190 of file stack.c.

References avr_free(), and stack_destroy().

Referenced by hwstack_new().

MemStack* memstack_new Memory *  mem  ) 
 

Allocate a new MemStack object.

Definition at line 363 of file stack.c.

References avr_new, class_overload_destroy(), memstack_construct(), and memstack_destroy().

Referenced by avr_core_construct().

void memstack_construct MemStack *  stack,
Memory *  mem
 

Constructor for MemStack object.

Definition at line 377 of file stack.c.

References avr_error, class_ref(), mem_attach(), and stack_construct().

Referenced by memstack_new().

void memstack_destroy void *  stack  ) 
 

Destructor for MemStack object.

Definition at line 395 of file stack.c.

References class_unref(), and stack_destroy().

Referenced by memstack_new().


Automatically generated by Doxygen 1.3.8 on 11 Aug 2004.