{"id":21159167,"url":"https://github.com/rufflewind/calico","last_synced_at":"2026-04-27T17:04:44.753Z","repository":{"id":78505658,"uuid":"55496017","full_name":"Rufflewind/calico","owner":"Rufflewind","description":"Utility library for C.","archived":false,"fork":false,"pushed_at":"2021-09-04T22:12:22.000Z","size":304,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-01T20:19:44.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rufflewind.com/calico","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/Rufflewind.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":"2016-04-05T09:43:28.000Z","updated_at":"2021-09-04T22:12:25.000Z","dependencies_parsed_at":"2023-05-21T00:00:45.107Z","dependency_job_id":null,"html_url":"https://github.com/Rufflewind/calico","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Rufflewind/calico","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fcalico","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fcalico/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fcalico/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fcalico/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rufflewind","download_url":"https://codeload.github.com/Rufflewind/calico/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rufflewind%2Fcalico/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32345872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-20T12:59:47.415Z","updated_at":"2026-04-27T17:04:44.736Z","avatar_url":"https://github.com/Rufflewind.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Calico\n\n[![Build status][bi]][bl]\n\n[bi]: https://github.com/Rufflewind/calico/actions/workflows/build.yml/badge.svg\n[bl]: https://github.com/Rufflewind/calico/actions/workflows/build.yml\n\n**Quick links**: [documentation](https://rufflewind.com/calico).\n\n## Headers\n\n**Note**: when including, all headers should be prefixed with `calico/`.\n\n### Ordinary headers\n\n  - `arithmetic.h`: checked arithmetic and related utilities.\n  - `binary_search.h`: binary search algorithm.\n  - `frozen_btree.h`: immutable associative array using a frozen B-tree.\n  - `linear_ordered_search.h`: linear search through an ordered array.\n  - `macros.h`: utility macros.\n  - `math.h`: mathemtical utilities.\n  - `packed_arithmetic.h`: arithmetic of packed vectors.\n  - `shuffle.h`: random shuffle algorithm.\n  - `wclock.h`: monotonic wall clock.\n\n### Template headers\n\n  - `btree_template.h` defines a B-tree data type and its associated\n    functions.  It can be used as an associative array container (map).  It\n    can also be used as a set, if the macro `Value` is left undefined.\n\n### Compatibility headers\n\n  - `compat/alignas_begin.h` and `compat/alignas_end.h`: define `alignas` if\n    available.  Otherwise, unless `RF_ALIGNAS_OPTIONAL` is defined, fail with\n    a preprocessor error.\n\n  - `compat/restrict_begin.h` and `compat/restrict_end.h`: define `restrict`\n    if available.  Otherwise, fall back to nothing.\n\n  - `compat/inline_begin.h` and `compat/inline_end.h`: define `inline` if\n    available.  Otherwise, fall back to `static`.\n\n  - `compat/noreturn_begin.h` and `compat/noreturn_end.h`: define `noreturn`\n    if available.  Otherwise, fall back to nothing.\n\n  - `compat/restrict_begin.h` and `compat/restrict_end.h`: define `restrict`\n    if available.  Otherwise, fall back to nothing.\n\n  - `compat/static_assert_begin.h` and `compat/static_assert_end.h`: define\n    `static_assert` if available.  Otherwise, fall back to some trickery.\n\n## Usage\n\n### Template headers\n\nTemplate headers are special C headers that can be included multiple times.\nThey generally expect some arguments, which are supplied through parameter\nmacros.  As an example, consider the `btree_template.h` header, which can be\nused like this:\n\n~~~c\n#include \u003ccalico/btree_head.h\u003e\n\n#define Prefix foo\n#define KeyType int\n#define ValueType double\n#include \u003ccalico/btree_template.h\u003e\n~~~\n\nThe *associated header* `btree_head.h` *must be included at least once* before\nany inclusions of the `btree_template.h` header.  Including `btree_head.h`\nmore than once is unnecessary but not harmful either.\n\nAfter including `btree_template.h`, the parameter macros (`Prefix`, `KeyType`,\nand `ValueType`) are automatically undefined.\n\nTypically, `Prefix` macro specifies the prefix that is attached to all\nidentifiers related to the template header.  For example, the example above\ncauses the type `foo_btree` to be defined, as well as functions such as\n`foo_btree_insert`.\n\n### Scoped headers\n\nThese headers come in `*_begin.h` and `*_end.h` pairs.  The purpose of such\nheaders is to minimize the risk of naming collisions, and hence it is a good\nidea to keep the scope of these headers as small as possible to avoid clashing\nwith other headers.  Nested inclusion of the same scoped headers is not\nallowed.\n\nTypical usage in a header file:\n\n~~~c\n#ifndef MY_INCLUDE_GUARD\n#define MY_INCLUDE_GUARD\n#include \u003cstddef.h\u003e\n/* other headers ... */\n#include \u003ccalico/compat/foobar_begin.h\u003e\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* header code ... */\n\n#ifdef __cplusplus\n}\n#endif\n#include \u003ccalico/compat/foobar_end.h\u003e\n#endif\n~~~\n\nIn a non-header file (`.c` or `.cpp`), one can be more lenient and simply use\nthe `*_begin.h` without the corresponding `*_end.h`.  For example:\n\n~~~c\n#include \u003cstdio.h\u003e\n/* other headers ... */\n#include \u003ccalico/compat/foobar_begin.h\u003e\n\n/* source code ... */\n~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufflewind%2Fcalico","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frufflewind%2Fcalico","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufflewind%2Fcalico/lists"}