{"id":13731156,"url":"https://github.com/zpl-c/zpl","last_synced_at":"2025-05-15T09:08:52.787Z","repository":{"id":22892766,"uuid":"96797726","full_name":"zpl-c/zpl","owner":"zpl-c","description":"📐 Pushing the boundaries of simplicity","archived":false,"fork":false,"pushed_at":"2025-04-26T08:13:13.000Z","size":4185,"stargazers_count":1020,"open_issues_count":3,"forks_count":47,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-06T17:00:54.264Z","etag":null,"topics":["c","cli","coroutines","cpp","cross-platform","csv-parser","hashing","header-only","helper","json5-parser","math","memory-allocation","memory-management","streaming-data","tar","thread-pool","threading","time","timer","zpl"],"latest_commit_sha":null,"homepage":"https://blog.zpl.pw","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zpl-c.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-10T16:17:42.000Z","updated_at":"2025-05-04T05:19:17.000Z","dependencies_parsed_at":"2024-06-18T18:27:55.632Z","dependency_job_id":"78762ee7-55d3-4525-978f-7f82db6ba434","html_url":"https://github.com/zpl-c/zpl","commit_stats":{"total_commits":1315,"total_committers":13,"mean_commits":"101.15384615384616","dds":0.1893536121673004,"last_synced_commit":"10de9a5821d5fe7b5278ada449856c52e07b2a96"},"previous_names":[],"tags_count":170,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpl-c%2Fzpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpl-c%2Fzpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpl-c%2Fzpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpl-c%2Fzpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zpl-c","download_url":"https://codeload.github.com/zpl-c/zpl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253908963,"owners_count":21982685,"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":["c","cli","coroutines","cpp","cross-platform","csv-parser","hashing","header-only","helper","json5-parser","math","memory-allocation","memory-management","streaming-data","tar","thread-pool","threading","time","timer","zpl"],"created_at":"2024-08-03T02:01:24.624Z","updated_at":"2025-05-15T09:08:47.780Z","avatar_url":"https://github.com/zpl-c.png","language":"C","funding_links":[],"categories":["Source Code Collections","源代码集合","Libraries"],"sub_categories":["Advanced books","高级书籍"],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://github.com/zpl-c/zpl\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/2182108/111983468-d5593e80-8b12-11eb-9c59-8c78ecc0504e.png\" alt=\"zpl\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://github.com/zpl-c/zpl/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/zpl-c/zpl/tester.yml?branch=master\u0026label=Tests\u0026style=for-the-badge\" alt=\"Build status\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://discord.gg/2fZVEym\"\u003e\u003cimg src=\"https://img.shields.io/discord/354670964400848898?color=7289DA\u0026style=for-the-badge\" alt=\"discord\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  C99 cross-platform header-only library oriented towards improving the coding experience.\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003csub\u003e\n    Brought to you by \u003ca href=\"https://github.com/zpl-zak\"\u003e@zpl-zak\u003c/a\u003e,\n     \u003ca href=\"https://github.com/inlife\"\u003e@inlife\u003c/a\u003e,\n    and \u003cstrong\u003econtributors\u003c/strong\u003e\n  \u003c/sub\u003e\n\u003c/div\u003e\n\n# Introduction\nWe have created the library to simplify the development process under C/C++ language, which offers a commonly used set of features that C developers often re-invent themselves. Apart from helper methods that replace/extend the C standard library, this toolkit also consists of modules that are very helpful in broad areas of expertise. The most notable is the JSON5 parser, math library, flexible file API, or various hashing algorithms.\n\nLibrary is cross-platform and currently works on **i386**, **amd64** and some **ARM** architectures. It has been tested on **Windows**, **UNIX-like systems**, **iOS**, **Emscripten** and **Android**.\nWe're trying to expand the compatibility, but we need your help! If you have a device you want to test zpl on, please let us know about your experience, and we can try to make it work together.\n\n# How to obtain this library?\n\nThere are several options in getting hands-on zpl:\n\n## 1. Via CLI (the simplest option)\n```sh\ncurl -L https://github.com/zpl-c/zpl/releases/latest/download/zpl.h \u003e zpl.h\n# OR\nwget https://github.com/zpl-c/zpl/releases/latest/download/zpl.h -O zpl.h\n```\n\nThis approach will download the latest release of zpl with everything prepared for you.\n\n## 2. Via GitHub releases page\n* Navigate to the [releases page](https://github.com/zpl-c/zpl/releases) of the zpl repository and pick the version you want to use. Each release contains the distributed version of zpl for you to use easily.\n\n## 3. Cloning the repository\n* Clone the repository by pressing the **Clone or download** button for instructions or use your terminal to clone:\n```sh\ngit clone https://github.com/zpl-c/zpl.git\n```\n\nWe use this method to develop zpl as it contains all the development sources that are easy to modify and expand, but it is not suitable for use in production.\n\nPlease follow the [CONTRIBUTING.md](.github/CONTRIBUTING.md) guide to learn how to contribute to the project.\n\n# Modules\n\n| Name | Description | Test Coverage | Example Coverage |\n| ------ | ---------- | :----: | :----: |\n| **Memory** | Low-level memory management and allocation strategy models. | 🟡 | ✅ |\n| **Collections** | Versatile set of collections: `array`, `buffer`, `linked list`, `ring buffer`. | 🔴 | ✅ |\n| **String** | Set of helpful string manipulation methods. | 🔴 | ✅ |\n| **String Libary** | C-friendly string library. | 🔴 | ✅ |\n| **Hashtable** | Instantiated hashtable implementation that works with any type. | 🔴 | ✅ |\n| **File** | File I/O operations forming a basis for other modules. | 🔴 | ✅ |\n| **File System** | Path and folder structure manipulation methods. | 🔴 | ✅ |\n| **TAR Archive** | Ability to archive files or analyze/unpack them. | 🔴 | ✅ |\n| **Memory Streamer** | Memory-mapped file I/O operations. | ✅ | ✅ |\n| **Print** | Re-implementation of various printf-family methods. | ✅ | ✅ |\n| **Time** | Helper methods for retrieving the current time in many forms under different precisions. | ✅ | ✅ |\n| **Random** | Fast and simple RNG library. | 🔴 | ✅ |\n| **Sorting** | Various sorting and searching algorithms. | 🔴 | ✅ |\n| **Threading** | Threading, and blocking models, thread merge operation based on stb_sync, as well as CPU affinity management. | 🔴 | ✅ |\n| **Regex** | Regular expressions library. | 🔴 | ✅ |\n| **DLL** | Cross-platform methods for loading dynamic libraries. | 🔴 | ✅ |\n| **Hashing** | Various hashing methods. Contains: `base64`, `adler32`, `crc32/64`, `fnv32/64/a` and `murmur32/64` | ✅ | ✅ |\n| **Text Parsers** | Various text parsers for different formats that offer cross-language transformations. Currently supported: `JSON5/SJSON`, `CSV`, `URI`. | ✅ | ✅ |\n| **Options** | CLI options parser. Parsing flags, switches, and arguments from the command line. | 🔴 | ✅ |\n| **Process** | Primitives for low-level process management. | 🔴 | ✅ |\n| **Jobs System** | Asynchronous task-based scheduling system. | 🔴 | ✅ |\n| **Math** | Gamedev friendly library for math. | 🔴 | ✅ |\n| **Miscellaneous** | Other valuable methods that are part of the core distribution. | ✅ | ✅ |\n\n## Distributions\n\nAll distributions are defined at compile-time. You can always opt-in to any distribution kind without a need to maintain different copies of the library.\n\n### Default\n\nzpl enables all of its modules by default, which allows you to make full use of the library effortlessly.\n\n### ZPL_NANO\n\nThe **nano** distribution provides the core parts of the library. It omits some specialized modules in favor of broader compatibility, and that also makes the library lightweight.\n\n### ZPL_PICO\nWe've also made a **pico** distribution that only contains: **Memory** and **Collections** modules. There is no ability to enable specific core submodules within the **pico** distribution; however, consider using the **nano** distribution in that case.\n\n### Custom distributions\n\nzpl also allows you to enable/disable various modules at will, allowing you to create your distribution suiting your needs.\n\n# Examples\nWe cover many of these modules with example code you can explore at [apps/examples](https://github.com/zpl-c/zpl/tree/master/code/apps/examples) folder. They serve as a good starting point to better understand how the library works. Have a look at this base64 text encoder:\n\n```c\n#define ZPL_IMPL\n#define ZPL_NANO\n#define ZPL_ENABLE_OPTS\n#define ZPL_ENABLE_HASHING\n#include \u003czpl.h\u003e\n\nvoid exit_with_help(zpl_opts *opts);\n\nint main(int argc, char **argv) {\n    zpl_opts opts={0};\n\n    zpl_opts_init(\u0026opts, zpl_heap(), argv[0]);\n    zpl_opts_add(\u0026opts, \"s\", \"string\", \"input string.\", ZPL_OPTS_STRING);\n    zpl_opts_positional_add(\u0026opts, \"string\");\n    zpl_b32 ok = zpl_opts_compile(\u0026opts, argc, argv);\n    if (!ok || !zpl_opts_positionals_filled(\u0026opts))\n        exit_with_help(\u0026opts);\n\n    zpl_string input = zpl_opts_string(\u0026opts, \"string\", 0);\n    zpl_u8 *encoded_str = zpl_base64_encode(zpl_heap(), cast(void*)input, zpl_string_length(input));\n    zpl_printf(\"Original: %s\\nEncoded: %s\\n\", input, encoded_str);\n\n    zpl_mfree(encoded_str);\n    zpl_opts_free(\u0026opts);\n    return 0;\n}\n\nvoid exit_with_help(zpl_opts *opts) {\n    zpl_opts_print_errors(opts);\n    zpl_opts_print_help(opts);\n    zpl_exit(-1);\n}\n```\n\n# Frequently Asked Questions\n\n**What is this library based on?**\n\nzpl is a fork of a library made by [@gingerBill](https://github.com/gingerBill) called [gb](https://github.com/gingerBill/gb) that we've decided to expand and rewrite\nto fit our needs better. Although many parts of the library still stay faithful to their original, a significant amount of work shaped the library into what we present now.\n\n**Can I contribute to the project?**\n\nYes, indeed. This project is dual-licensed according to [LICENSE](LICENSE). You are free to fork it, contribute to it, or even sell it as you see fit.\n\n**Can I submit suggestions?**\n\nIndeed, we'd also gladly discuss those with you on Discord, if possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzpl-c%2Fzpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzpl-c%2Fzpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzpl-c%2Fzpl/lists"}