Quash Shell
0.1
A simple yet powerfull shell program
|
Classes | |
struct | Example |
A data structure generated by IMPLEMENT_DEQUE_STRUCT() to store the state of a deque. More... | |
Typedefs | |
typedef char | Type |
An example type used for example purposes only. | |
typedef struct Example | Example |
Functions | |
Example | new_Example (size_t) |
Create a new, fully initialized deque structure. More... | |
Example | new_destructable_Example (size_t, void(*)(Type)) |
Create a new, fully initialized deque structure with a destructor that is applied to every element when the destroy_Example() function is called. More... | |
void | destroy_Example (Example *) |
Destroy the deque structure freeing memory if necessary. More... | |
void | empty_Example (Example *) |
Quickly empties the deque structure. More... | |
bool | is_empty_Example (Example *) |
Checks if the deque is empty. More... | |
size_t | length_Example (Example *) |
Query the number of elements in the deque. More... | |
Type * | as_array_Example (Example *, size_t *) |
Extract an array based off the deque. More... | |
void | apply_Example (Example *, void(*)(Type)) |
Calls the function func on every element in the deque. More... | |
void | push_front_Example (Example *, Type) |
Insert an element to the front of the deque. More... | |
void | push_back_Example (Example *, Type) |
Insert an element to the back of the deque. More... | |
Type | pop_front_Example (Example *) |
Remove an element from the front of the deque. More... | |
Type | pop_back_Example (Example *) |
Remove an element from the back of the deque. More... | |
Type | peek_front_Example (Example *) |
Get a copy of the element at the front of the deque. More... | |
Type | peek_back_Example (Example *) |
Remove an element from the back of the deque. More... | |
void | update_front_Example (Example *, Type) |
Change the element at the front of the deque to be a copy of element. More... | |
void | update_back_Example (Example *, Type) |
Change the element at the front of the deque to be a copy of element. More... | |
Calls the function func on every element in the deque.
deq | A pointer to the deque to apply the function func to |
func | A pointer to a function that takes an element of type |
Extract an array based off the deque.
deq | in A pointer to the deque to extract an array from | |
[out] | len | A pointer to an size_t value. This value will be set to the current length of the deque returned from the length_Example() function. If knowing the length of the array is unnecessary then NULL may be passed as this parameter. |
void destroy_Example | ( | Example * | deq | ) |
Destroy the deque structure freeing memory if necessary.
deq | A pointer to the deque to destory |
void empty_Example | ( | Example * | deq | ) |
bool is_empty_Example | ( | Example * | deq | ) |
Checks if the deque is empty.
deq | A pointer to the deque to check if empty |
size_t length_Example | ( | Example * | deq | ) |
Query the number of elements in the deque.
deq | A pointer to the deque to calculate the length of |
Create a new, fully initialized deque structure with a destructor that is applied to every element when the destroy_Example() function is called.
Specifying the destructor is useful to not have to manually iterate over the deque destroying any malloc'd memory in each element. The destructor function should not free any memory residing in memory pools.
init_cap | Initial capacity of the deque |
destructor | A function that is run on each element in the deque when destroy_Example() is called |
Example new_Example | ( | size_t | init_cap | ) |
Create a new, fully initialized deque structure.
init_cap | Initial capacity of the deque |