{"id":16811680,"url":"https://github.com/raysan5/rini","last_synced_at":"2025-04-09T12:06:25.779Z","repository":{"id":166819532,"uuid":"642409459","full_name":"raysan5/rini","owner":"raysan5","description":"A simple and easy-to-use config init files reader and writer","archived":false,"fork":false,"pushed_at":"2025-01-26T20:02:17.000Z","size":80,"stargazers_count":75,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T06:49:11.341Z","etag":null,"topics":["config","init"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raysan5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":"raysan5","patreon":"raylib","open_collective":null,"ko_fi":"raysan","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2023-05-18T13:56:27.000Z","updated_at":"2025-03-04T02:37:29.000Z","dependencies_parsed_at":"2024-10-26T21:13:54.756Z","dependency_job_id":"6b2203d5-9f0b-4256-b259-afc0e273b052","html_url":"https://github.com/raysan5/rini","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":"0.16666666666666663","last_synced_commit":"e315182e3a74eb18e57607354dc631e3a3232f92"},"previous_names":["raysan5/rini"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysan5%2Frini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysan5%2Frini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysan5%2Frini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysan5%2Frini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raysan5","download_url":"https://codeload.github.com/raysan5/rini/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036063,"owners_count":21037092,"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":["config","init"],"created_at":"2024-10-13T10:19:26.452Z","updated_at":"2025-04-09T12:06:25.750Z","avatar_url":"https://github.com/raysan5.png","language":"C","readme":"\u003cimg align=\"left\" src=\"https://github.com/raysan5/rini/blob/main/logo/rini_256x256.png\" width=256\u003e\n\n**rini is a simple and easy-to-use config init files reader and writer**\n\n`rini` is provided as a self-contained portable single-file header-only library with no external dependencies. \nIts only dependency, the standard C library, can also be replaced with a custom implementation if required.\n\nMultiple configuration options are available through `#define` values.\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n## features\n\n - Config files reading and writing\n - Supported value types: int, string\n - Support comment lines and empty lines\n - Support custom line comment delimiter\n - Support custom value delimiters\n - Support value description comments\n - Support custom description custom delimiter\n - Support multi-word text values w/o quote delimiters\n - Minimal C standard lib dependency (optional)\n - Customizable maximum config values capacity\n\n## configuration\n\n`#define RINI_IMPLEMENTATION`\n\nGenerates the implementation of the library into the included file.\nIf not defined, the library is in header only mode and can be included in other headers\nor source files without problems. But only ONE file should hold the implementation.\n\n`#define RINI_MAX_CONFIG_CAPACITY`\n\nDefine the maximum capacity of config data structure, customizable by user.\nDefault value: 32 entries support\n\n`#define RINI_LINE_COMMENT_DELIMITER`\n\nDefine character used to comment lines, placed at beginning of line\nMost .ini files use semicolon ';' but '#' is also used\nDefault value: '#'\n\n`#define RINI_LINE_SECTION_DELIMITER`\n\nDefines section lines start character\nSections loading is not supported, lines are just skipped for now\n\n`#define RINI_VALUE_COMMENTS_DELIMITER`\n\nDefines a property line-end comment delimiter\nThis implementation allows adding inline comments after the value.\nDefault value: '#'\n\n`#define RINI_VALUE_DELIMITER`\n\nDefines a key value delimiter, in case it is defined.\nMost .ini files use '=' as value delimiter but ':' is also used or just whitespace\nDefault value: ' '\n\n`#define RINI_VALUE_QUOTATION_MARKS`\n\nDefines quotation marks to be used around text values \nText values are determined checking text with atoi(), only for integer values,\nin case of float values they are always considered as text\nDefault value: '\\\"'\n\n`#define RINI_DESCRIPTION_DELIMITER`\n\nDefines a property line-end comment delimiter\nThis implementation allows adding inline comments after the value.\nDefault value: '#'\n \n## basic functions\n\n```c\n// Load/unload config from file (*.ini) or create a new config object (pass NULL)\nrini_config rini_load_config(const char *file_name);            \nvoid rini_unload_config(rini_config *config);\n\n// Save config to file, with custom header (if provided)\n// NOTE: Only full config file rewrite supported, no partial updates\nvoid rini_save_config(rini_config config, const char *file_name);\n\n// Get config value int/text/description for provided key, returns -1 or NULL if not found\nint rini_get_config_value(rini_config config, const char *key);\nconst char *rini_get_config_value_text(rini_config config, const char *key); \nconst char *rini_get_config_value_description(rini_config config, const char *key);\n\n// Set config value int/text and description for existing key or create a new entry\n// NOTE: When setting a text value, if id does not exist, a new entry is automatically created\nint rini_set_config_value(rini_config *config, const char *key, int value, const char *desc);\nint rini_set_config_value_text(rini_config *config, const char *key, const char *text, const char *desc); \n\n// Set config value description for existing key\n// WARNING: Key must exist to add description, if a description exists, it is updated\nint rini_set_config_value_description(rini_config *config, const char *key, const char *desc); \n```\n\n## limitations\n\n - Config `[sections]` not supported\n - Saving config file requires complete rewrite\n\n## usage example\n\nLoad an existing config file\n```c\n#define RINI_IMPLEMENTATION\n#include \"rini.h\"\n\nint main()\n{\n    rini_config config = rini_load_config(\"config.ini\");\n\n    int show_window_sponsors_value = rini_get_config_value(config, \"SHOW_WINDOW_SPONSORS\");\n    int show_window_info_value = rini_get_config_value(config, \"SHOW_WINDOW_INFO\");\n    int show_window_edit_value = rini_get_config_value(config, \"SHOW_WINDOW_EDIT\");\n    int image_scale_filter_value = rini_get_config_value(config, \"IMAGE_SCALE_FILTER\");\n    int image_background_value = rini_get_config_value(config, \"IMAGE_BACKGROUND\");\n    int visual_style_value = rini_get_config_value(config, \"VISUAL_STYLE\");\n    int clean_window_mode_value = rini_get_config_value(config, \"CLEAN_WINDOW_MODE\");\n\n    rini_unload_config(\u0026config);\n\n    return 0;\n}\n```\n\nSave a custom config file:\n```c\n#define RINI_IMPLEMENTATION\n#include \"rini.h\"\n\nint main()\n{\n    // Create empty config with 32 entries (RINI_MAX_CONFIG_CAPACITY)\n    rini_config config = rini_load_config(NULL);\n\n    // Define header comment lines\n    rini_set_config_comment_line(\u0026config, NULL);   // Empty comment line, but including comment prefix delimiter\n    rini_set_config_comment_line(\u0026config, \"rTexViewer initialization configuration options\");\n    rini_set_config_comment_line(\u0026config, NULL);\n    rini_set_config_comment_line(\u0026config, \"NOTE: This file is loaded at application startup,\");\n    rini_set_config_comment_line(\u0026config, \"if file is not found, default values are applied\");\n    rini_set_config_comment_line(\u0026config, NULL);\n\n    // Define config values\n    rini_set_config_value(\u0026config, \"SHOW_WINDOW_SPONSORS\", 1, \"Show sponsors window at initialization\");\n    rini_set_config_value(\u0026config, \"SHOW_WINDOW_INFO\", 0, \"Show image info window\");\n    rini_set_config_value(\u0026config, \"SHOW_WINDOW_EDIT\", 0, \"Show image edit window\");\n    rini_set_config_value(\u0026config, \"IMAGE_SCALE_FILTER\", 1, \"Image scale filter enabled: 0-Point, 1-Bilinear\");\n    rini_set_config_value(\u0026config, \"IMAGE_BACKGROUND\", 0, \"Image background style: 0-None, 1-Checked, 2-Black, 3-Magenta\");\n    rini_set_config_value(\u0026config, \"VISUAL_STYLE\", 2, \"UI visual style selected: 0-9\");\n    rini_set_config_value(\u0026config, \"CLEAN_WINDOW_MODE\", 0, \"Clean window mode enabled\");\n\n    rini_save_config(config, \"config.ini\", ini_header);\n\n    rini_unload_config(\u0026config);\n    \n    return 0;\n}\n```\n\n## license\n\nrini is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.\n","funding_links":["https://github.com/sponsors/raysan5","https://patreon.com/raylib","https://ko-fi.com/raysan"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraysan5%2Frini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraysan5%2Frini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraysan5%2Frini/lists"}