{"id":18051806,"url":"https://github.com/joegasewicz/stacks","last_synced_at":"2025-09-11T10:45:05.582Z","repository":{"id":197112059,"uuid":"697925273","full_name":"joegasewicz/stacks","owner":"joegasewicz","description":"A stack structure static library written in C with a few extra features","archived":false,"fork":false,"pushed_at":"2023-09-30T16:37:03.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T14:53:19.984Z","etag":null,"topics":["abstract-data-types","c","cprogramming","stack"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joegasewicz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-28T18:56:50.000Z","updated_at":"2023-10-05T21:22:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"3eb57ed8-00ab-43da-ab95-750361477b7c","html_url":"https://github.com/joegasewicz/stacks","commit_stats":null,"previous_names":["joegasewicz/stacks"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fstacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fstacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fstacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joegasewicz%2Fstacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joegasewicz","download_url":"https://codeload.github.com/joegasewicz/stacks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299850,"owners_count":20916193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abstract-data-types","c","cprogramming","stack"],"created_at":"2024-10-30T22:56:05.688Z","updated_at":"2025-04-05T07:13:48.303Z","avatar_url":"https://github.com/joegasewicz.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stacks\nA stack structure static library written in C with a few extra features\n- Set the stack to have either a dynamic or static length\n- An error will be returned if the stack reaches its maximum set length\n- Get the stack's current (*node's*) index at any time\n\n### Initiate\nOptions allow the stack length to be set to dynamic or static. \nWithout options the stack will have a dynamic length.\n```c\nStack *my_stack = S_Stack_new(NULL);\n```\nWith options the stack will return a `S_OUT_OF_BOUNDS_ERROR`.\n```c\nS_Options options = (S_Options){ .max_length = 1, .dynamic = false };\n// still within max_length limit\nint ok = S_Stack_push(my_stack, \u0026data1);\nassert(S_OUT_OF_BOUNDS_ERROR != ok);\n\n// exceeded the max_length\nint err = S_Stack_push(my_stack, \u0026data2);\nassert(S_OUT_OF_BOUNDS_ERROR == err);\n\n```\n### Destroy\nDetaches each node from the stack.\nThis function does not destroy allocated memory assigned to the node's data.\n```c\nif (S_Stack_destroy(my_stack) \u003c 0)\n    perror(\"panic!\");\n```\n\n### Push\nPushes the next node on the stack.\nYou must initiate the stack by calling the S_Stack_new(NULL) first.\nIt is the responsibility of the caller to manage the memory of void *data.\n```c\nint data1 = 1, data2 = 2; // *void\nS_Stack_push(my_stack, \u0026data1);\nS_Stack_push(my_stack, \u0026data2);\n```\n\n### Pop\nRemoves the top nod from the stack. \nThe caller must manage the memory of void *data.\n```c\nvoid* data = S_Stack_pop(my_stack);\n```\n\n### Peek *(macro)*\nEnables the caller to peek at the top node without popping it off the stack.\nIt returns a reference to the top node.\n```c\nvoid *data = S_PEEK(my_stack);\n```\n\n### Size *(macro)*\nReturns the size of the stack based on total count of nodes.\n```c\nint stack_size = S_SIZE(my_stack);\n```\n\n### Current Index *(macro)*\nReturns the current node index (or top node on the stack).\n```c\nint current_node_index = S_CURRENT_INDEX(my_stack);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoegasewicz%2Fstacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoegasewicz%2Fstacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoegasewicz%2Fstacks/lists"}