ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1// ProtoCore v1.0.16 - Copyright (C) 2026 Douglas Quigg (dstroy0) <dquigg123@gmail.com>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4/**
5 * @file types.h
6 * @brief The primitive types every other file is written in. They are those of embedded_types.
7 *
8 * embed_types.h states each width, embed_bool, ::embed_word and ::embed_index. The build states
9 * EMBED_WORD_BITS and EMBED_INDEX_BITS for each target, so that ProtoCore, MMgr and idemIP read one word and
10 * one index.
11 *
12 * @author Douglas Quigg (dstroy0)
13 * @date 2026
14 */
15
16#ifndef PROTOCORE_TYPES_H
17#define PROTOCORE_TYPES_H
18
19#include <assert.h> // C11 spells static_assert here; C++ has it built in
20#include <stddef.h> // size_t, and the one place it enters the library
21#include <stdint.h>
22
23#include "embed_atomic.h" // the atomic words, for each field that two tasks reach
24#include "embed_compiler_directives.h" // EMBED_INLINE, EMBED_BEGIN_DECLS, EMBED_ENUM_BYTE
25#include "embed_dispatch_layout.h" // EMBED_CALL, which the C++ arm below restates
26#include "embed_types.h" // the widths, embed_bool, embed_word and embed_index
27
28// C++ has no compound literal to take the address of, so a C++ translation unit builds the
29// argument struct as a temporary. It lives to the end of the full expression, which is the call.
30#ifdef __cplusplus
31extern "C++"
32{
33 template <typename ArgsType> const ArgsType *protocore_call_args(const ArgsType &args)
34 {
35 return &args;
36 }
37}
38#undef EMBED_CALL
39#define EMBED_CALL(entry_, ArgsType_, ...) entry_(protocore_call_args(ArgsType_{__VA_ARGS__}))
40#endif
41
42#endif // PROTOCORE_TYPES_H