diff options
| author | 2024-07-08 19:58:22 -0400 | |
|---|---|---|
| committer | 2024-07-08 19:58:22 -0400 | |
| commit | 4f7847b2c0219995c4fe2d0858b5030e73581a3c (patch) | |
| tree | 9b84a1fc5698a4f8b97c0580fccf2b26c000d748 /include/internal | |
| parent | delete for hashtables (diff) | |
Major API reorganization, test infrastructure
The API is now hidden behind functions. The GC struct can have an
unstable layout without affecting any compiled binaries (users of
Universal Service or collectors hidden behind the API). The
collectors can be called directly if desired.
The API now allows for different allocation flags. These will be
used in future extensions (like weak pointers). For now none are
used.
Tests are compiled for each collector. I can't think of a good
solution that will encompass everything I want to write, but for
now this will work on POSIX systems.
Diffstat (limited to 'include/internal')
| -rw-r--r-- | include/internal/c89_relo.h | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/include/internal/c89_relo.h b/include/internal/c89_relo.h deleted file mode 100644 index 1226ce2..0000000 --- a/include/internal/c89_relo.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef UNS_FORMAT_C89_H -#define UNS_FORMAT_C89_H -/* Copyright (C) 2024 Peter McGoron - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program. If not, see - * <https://www.gnu.org/licenses/>. -*/ - -#include "uns.h" - -/* This is a strictly C89+ header format with relocation pointers and - * lengths. - * - * Forwarding pointers need to be stored in the header because in strict - * C, arithmetic on pointers is undefined for pointers not pointing into - * the same object. - * - * The length of the string is limited to "len" bytes and is stored as - * a `uns_sword`. If the word is negative, then the region is a record, - * and if the number is positive then the region is just bytes. - */ - -struct uns_c89_relo_hdr { - void *relo; - uns_sword len; -}; -#define uns_c89_relo_get_hdr(p)((struct uns_c89_relo_hdr *)(p) - 1) - -size_t uns_c89_relo_get_len(void *p); -size_t uns_c89_relo_get_record_len(void *p); - -#define uns_c89_relo_get_relo(p) (uns_c89_relo_get_hdr(p)->relo) -#define uns_c89_relo_set_relo(p, v) (uns_c89_relo_get_relo(p) = (v)) -#define uns_c89_relo_is_record(p) (uns_c89_relo_get_hdr(p)->len < 0) - -void *uns_c89_relo_init(void *p, size_t len_size, int is_record); - -void uns_c89_relo_record_set(Uns_ptr rec, size_t i, void *v); -void *uns_c89_relo_record_get(Uns_ptr rec, size_t i); - -#endif |
