From 15dd829205d965afdf92ac30a086e30baf926ec6 Mon Sep 17 00:00:00 2001 From: wael Date: Fri, 10 Sep 2021 19:51:49 +0300 Subject: [PATCH] Finish stack docs and update docs gen script. --- docs/generate_docs.sh | 2 +- docs/stack/stack.h.ms | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/generate_docs.sh b/docs/generate_docs.sh index 19aaf95..c0d54d9 100755 --- a/docs/generate_docs.sh +++ b/docs/generate_docs.sh @@ -5,7 +5,7 @@ # Prompt user at the start for what type they want. # Specify the file paths, in the order where they should be built. -filepaths=('nodes/single_node.h.ms' 'nodes/double_node.h.ms' 'nodes/tree_node.h.ms' 'strings/strzcpy.ms') +filepaths=('nodes/single_node.h.ms' 'nodes/double_node.h.ms' 'nodes/tree_node.h.ms' 'strings/strzcpy.ms' 'stack/stack.h.ms' 'linked_lists/double_linked_list.h.ms' 'linked_lists/single_linked_list.h.ms') # Prompt the user for the option they want (pdf/html/utf8). echo "Please choose an output option: pdf, html or utf8." diff --git a/docs/stack/stack.h.ms b/docs/stack/stack.h.ms index c883a0d..e53b81c 100644 --- a/docs/stack/stack.h.ms +++ b/docs/stack/stack.h.ms @@ -46,3 +46,14 @@ stack_t* initialize_stack() - This function initializes a new empty stack, retur .br node_t* pop(stack_t *stack) - Pops the head of the stack, returns NULL on empty or NULL stack. .br +const void* peek(stack_t *stack) - Peeks at the top of the stack, returns the stored value there without popping. +.br +int push(stack_t *stack, node_t *node) - Pushes a node into the top of the stack, fails on NULL input. +.br +int push_data(stack_t *stack, void *data) - Pushes a node into the top of the stack, fails on NULL stack or allocation error. +.br +int stack_size(stack_t *stack) - This function returns the stack's size, returns INVALID_SIZE on error or NULL stack. +.br +void free_stack(stack_t **stack) - This function frees a stack and sets the pointer (*stack) to NULL, doesn't touch the data. +.br +void free_stack_data(stack_t **stack, void (*free_function)(const void*)) - This function frees a stack and sets the pointer (*stack) to NULL, frees the data too, if free_function is NULL will use standard free() instead.