# stack.c File Reference

Stack routines for Discover. More...

`#include <stdio.h>`
`#include <assert.h>`
`#include <stdbool.h>`
`#include <stdlib.h>`
`#include <discover/utils.h>`
`#include <discover/stack.h>`

Go to the source code of this file.

## Functions

discover_xml_stack * | discover_xml_stack_new ()
void | discover_xml_stack_destroy (discover_xml_stack *stack)
void | discover_xml_stack_push (discover_xml_stack **stack, void *data)
void * | discover_xml_stack_pop (discover_xml_stack **stack)
void * | discover_xml_stack_get (discover_xml_stack *stack)
void * | discover_xml_stack_getbynum (discover_xml_stack *stack, int i)

## Detailed Description

Stack routines for Discover.

This is a generic stack routine that Discover uses. The stack is needed because there wasn't a good way to track the traversal depth through the XML data. These routines brought much sanity to the XML parsing process. They are generic enough that they can be used for any number of applications.

Definition in file stack.c.

## Function Documentation

void discover_xml_stack_destroy | ( | discover_xml_stack * | stack | ) |

| Routine responsible for destroying the stack base once we're done Definition at line 62 of file stack.c. Referenced by discover_xml_stack_pop().

void* discover_xml_stack_get | ( | discover_xml_stack * | stack | ) |

| Return the top item without popping it. Definition at line 103 of file stack.c.

void* discover_xml_stack_getbynum | ( | discover_xml_stack * | stack,
|  | int | i
| ) |

| Return the item at depth i on the stack. Definition at line 109 of file stack.c.

discover_xml_stack* discover_xml_stack_new | ( |  | ) |

| Routine responsible for creating the base of the stack Definition at line 48 of file stack.c. Referenced by discover_xml_stack_push().

void* discover_xml_stack_pop | ( | discover_xml_stack ** | stack | ) |

| Pop an item from the stack. Definition at line 83 of file stack.c. References discover_xml_stack_destroy().

void discover_xml_stack_push | ( | discover_xml_stack ** | stack,
|  | void * | data
| ) |

| Push an item onto the stack. Definition at line 69 of file stack.c. References discover_xml_stack_new().