libdatatypes 0.3.2
Abstract datatypes for C.
Loading...
Searching...
No Matches
stack.h
Go to the documentation of this file.
1/***************************************************************************
2 begin........: June 2012
3 copyright....: Sebastian Fedrau
4 email........: sebastian.fedrau@gmail.com
5 ***************************************************************************/
6
7/***************************************************************************
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License v3 as published by
10 the Free Software Foundation.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License v3 for more details.
16 ***************************************************************************/
22#ifndef STACK_H
23#define STACK_H
24
25#include "slist.h"
26
31typedef SList Stack;
32
38
47#define stack_new(compare, free, pool) slist_new(compare, free, pool)
48
57#define stack_init(stack, compare, free, pool) slist_init(stack, compare, free, pool)
58
64#define stack_destroy(stack) slist_destroy(stack)
65
71#define stack_free(stack) slist_free(stack)
72
79#define stack_push(stack, data) slist_prepend(stack, data)
80
88bool stack_head(const Stack *stack, void **data);
89
97bool stack_pop(Stack *stack, void **data);
98
104#define stack_clear(stack) slist_clear(stack)
105
112#define stack_count(stack) slist_count(stack)
113
114#endif
115
Singly-linked list.
Singly-linked list.
Definition slist.h:49
bool stack_head(const Stack *stack, void **data)
Definition stack.c:55
SList Stack
Generic stack.
Definition stack.h:31
bool stack_pop(Stack *stack, void **data)
Definition stack.c:28
SList StackItem
Holds stack item data & pointer to next element.
Definition stack.h:37