### Meson Setup Command Source: https://github.com/drobilla/zix/blob/main/INSTALL.md Configures the build directory for the project using Meson. Creates a new build directory with the specified name. ```bash meson setup build ``` -------------------------------- ### Meson Install Command Source: https://github.com/drobilla/zix/blob/main/INSTALL.md Installs the compiled project. May require root permissions for system-wide installation. Supports staging for packaging. ```bash meson install ``` ```bash DESTDIR=/tmp/mypackage/ meson install ``` ```bash meson install --destdir=/tmp/mypackage/ ``` -------------------------------- ### Meson Configure Command Source: https://github.com/drobilla/zix/blob/main/INSTALL.md Inspects and configures build options within a Meson build directory. Allows setting compiler flags and installation prefixes. ```bash cd build meson configure ``` ```bash meson configure -Dc_args="-march=native" -Dprefix="/opt/mypackage/" ``` -------------------------------- ### Meson Compile Command Source: https://github.com/drobilla/zix/blob/main/INSTALL.md Builds the project from within a configured Meson build directory. ```bash meson compile ``` -------------------------------- ### Meson Test Command Source: https://github.com/drobilla/zix/blob/main/INSTALL.md Runs the tests for the project from within a configured Meson build directory. ```bash meson test ``` -------------------------------- ### Zix Filesystem and Environment Utilities Source: https://github.com/drobilla/zix/blob/main/README.md Contains functions for working with filesystems, filesystem paths, and expanding shell-style environment variables within strings. ```C #include #include #include // Example: Expanding environment variables const char* input_string = "User home: $HOME"; char* expanded_string = zix_env_expand(input_string); // ... use expanded_string ... free(expanded_string); ``` -------------------------------- ### Zix Project Build Feature Options Source: https://github.com/drobilla/zix/blob/main/meson_options.txt Configures build features for the Zix project, such as benchmarks, checks, documentation generation (HTML and single-page), POSIX compatibility, threading, and testing. ```meson option('benchmarks', type: 'feature', description: 'Build benchmarks') option('checks', type: 'feature', value: 'enabled', description: 'Check for platform-specific features') option('docs', type: 'feature', description: 'Build documentation') option('html', type: 'feature', description: 'Build paginated HTML documentation') option('posix', type: 'feature', description: 'Use POSIX system facilities') option('singlehtml', type: 'feature', description: 'Build single-page HTML documentation') option('threads', type: 'feature', description: 'Enable thread support') option('tests', type: 'feature', description: 'Build tests') option('tests_cpp', type: 'feature', description: 'Build C++ standard library comparison tests') ``` -------------------------------- ### Zix Data Structures Source: https://github.com/drobilla/zix/blob/main/README.md Includes implementations for a page-allocated B-tree, an open-addressing hash table, a lock-free realtime-safe ring buffer, and a binary search tree. ```C #include #include #include #include // Example: ZixHash usage ZixHash hash_table; zix_hash_init(&hash_table, 100, NULL, NULL); zix_hash_insert(&hash_table, "key1", "value1"); const char* value = zix_hash_lookup(&hash_table, "key1"); zix_hash_destroy(&hash_table); ``` -------------------------------- ### Zix Project General Configuration Options Source: https://github.com/drobilla/zix/blob/main/meson_options.txt Sets general configuration parameters for the Zix project, including the project title, linting status, and Windows-specific settings like API version and wchar_t usage. ```meson option('lint', type: 'boolean', value: false, description: 'Run code quality checks') option('title', type: 'string', value: 'Zix', description: 'Project title') option('win_ver', type: 'combo', value: 'win8', choices: ['nt4', 'winxp', 'vista', 'win8'], description: 'Latest Windows API version to use') option('win_wchar', type: 'feature', description: 'Use UTF-16 wchar_t and UNICODE with Windows API') ``` -------------------------------- ### Zix Allocator Implementations Source: https://github.com/drobilla/zix/blob/main/README.md Provides a customizable allocator interface and a simple realtime-safe bump-pointer allocator for efficient memory management. ```C #include #include // Example usage of ZixBumpAllocator ZixBumpAllocator allocator; void* memory = malloc(1024); zix_bump_allocator_init(&allocator, memory, 1024); void* data = zix_bump_allocator_alloc(&allocator, 128); // ... use data ... zix_bump_allocator_reset(&allocator); free(memory); ``` -------------------------------- ### Zix Threading Wrappers Source: https://github.com/drobilla/zix/blob/main/README.md Provides portable wrappers for semaphores and threads, simplifying cross-platform threading development. ```C #include #include // Example: ZixThread usage void* thread_function(void* arg) { // thread logic return NULL; } ZixThread thread; zix_thread_init(&thread, thread_function, NULL, NULL); zix_thread_join(&thread, NULL); ``` -------------------------------- ### Zix Static String View Source: https://github.com/drobilla/zix/blob/main/doc/string_views.rst Initializes a string view from a string literal. This macro is intended for inlined string literals only. ```c #define ZIX_STATIC_STRING(s) \ ((ZixStringView){ (s), sizeof(s) - 1 }) ``` -------------------------------- ### Zix Digest Functions Source: https://github.com/drobilla/zix/blob/main/README.md Offers digest functions suitable for hashing arbitrary data, commonly used in data integrity checks and hash table implementations. ```C #include // Example usage of digest functions const char* data_to_hash = "sample data"; size_t data_len = strlen(data_to_hash); unsigned char hash_output[32]; // Assuming a 32-byte hash output zix_digest_sha256((const uint8_t*)data_to_hash, data_len, hash_output); // ... use hash_output ... ``` -------------------------------- ### Zix Empty String View Source: https://github.com/drobilla/zix/blob/main/doc/string_views.rst Constructs a view representing an empty string. This is useful for initializing string views that should be empty. ```c ZixStringView zix_empty_string(void) { return (ZixStringView){ NULL, 0 }; } ``` -------------------------------- ### Zix Substring View from Pre-measured String Source: https://github.com/drobilla/zix/blob/main/doc/string_views.rst Constructs a view of a slice of a string with an explicitly provided length. This is more efficient if the string's length is already known. ```c ZixStringView zix_substring(const char *s, size_t length) { return (ZixStringView){ s, length }; } ``` -------------------------------- ### Zix Error Handling with ZixStatus Source: https://github.com/drobilla/zix/blob/main/doc/error_handling.rst Explains the primary error handling mechanism in Zix, where functions return a ZixStatus enum to indicate success or failure. It also mentions the utility function for obtaining descriptive error strings. ```c .. default-domain:: c .. highlight:: c Most functions return a :enum:`ZixStatus` which describes whether they succeeded (with zero, or :enumerator:`ZIX_STATUS_SUCCESS`) or why they failed. The human-readable message for a status can be retrieved with :func:`zix_strerror`. ``` -------------------------------- ### Zix String View from Null-Terminated String Source: https://github.com/drobilla/zix/blob/main/doc/string_views.rst Constructs a view of an arbitrary null-terminated string by measuring its length using strlen. Compilers may optimize this for literals. ```c ZixStringView zix_string(const char *s) { return (ZixStringView){ s, strlen(s) }; } ``` -------------------------------- ### Zix Allocator Functions Source: https://github.com/drobilla/zix/blob/main/doc/allocation.rst Provides functions for memory allocation using custom allocator schemes. Memory allocated with an allocator must be freed using the same allocator. ```c /* Allocate memory using a Zix allocator */ void *zix_malloc(ZixAllocator *allocator, size_t size); /* Free memory allocated with a Zix allocator */ void zix_free(ZixAllocator *allocator, void *ptr); /* Get the default system allocator */ ZixAllocator *zix_default_allocator(void); /* Create a bump-pointer allocator */ ZixAllocator *zix_bump_allocator(void *buffer, size_t size); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.