Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/runtime/include/iec_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

#pragma once

#include "iec_platform.hpp"

#include <array>
#include <cstdint>
#include <stdexcept>
#include "iec_var.hpp"

Expand Down
3 changes: 2 additions & 1 deletion src/runtime/include/iec_char.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include "iec_types.hpp"

namespace strucpp {
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/include/iec_date.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include "iec_types.hpp"

namespace strucpp {
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/include/iec_dt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include "iec_types.hpp"
#include "iec_date.hpp"
#include "iec_tod.hpp"
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/include/iec_enum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include <ostream>
#include <type_traits>
#include "iec_var.hpp"
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/include/iec_located.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include <stdexcept>

namespace strucpp {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/include/iec_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#pragma once

#include <cstdlib>
#include <cstddef>
#include "iec_platform.hpp"

#include <new>
#include "iec_ptr.hpp"

Expand Down
30 changes: 30 additions & 0 deletions src/runtime/include/iec_platform.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: GPL-3.0-or-later WITH STruCpp-runtime-exception
// Copyright (C) 2025 Autonomy / OpenPLC Project
// This file is part of the STruC++ Runtime Library and is covered by the
// STruC++ Runtime Library Exception. See COPYING.RUNTIME for details.
/**
* STruC++ Runtime - Platform Compatibility Header
*
* AVR (Arduino) toolchains don't ship C++ standard library wrappers like
* <cstdint>, <cstring>, etc. This header provides a single compatibility
* shim that maps to the correct C headers on AVR and C++ headers elsewhere.
*
* All other runtime headers should include this instead of <cstdint> etc.
*/

#pragma once

#if defined(__AVR__) || defined(ARDUINO)
// AVR libc provides C headers only, not C++ wrappers
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#else
#include <cstdint>
#include <cstddef>
#include <cstring>
#include <cstdlib>
#include <cmath>
#endif
3 changes: 2 additions & 1 deletion src/runtime/include/iec_pointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@

#pragma once

#include <cstddef>
#include "iec_platform.hpp"

#include <stdexcept>
#include <string>
#include "iec_var.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/include/iec_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

#pragma once

#include <cstdint>
#include <cstddef>
#include "iec_platform.hpp"

#include <type_traits>

namespace strucpp {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/include/iec_retain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#pragma once

#include <cstddef>
#include <cstdint>
#include "iec_platform.hpp"


namespace strucpp {

Expand Down
5 changes: 2 additions & 3 deletions src/runtime/include/iec_std_lib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@

#pragma once

#include "iec_platform.hpp"

#include "iec_var.hpp"
#include "iec_traits.hpp"
#include "iec_retain.hpp"
#include "iec_ptr.hpp"
#include <cmath>
#include <algorithm>
#include <cstddef>
#include <cstring>
#include <type_traits>

namespace strucpp {
Expand Down
5 changes: 2 additions & 3 deletions src/runtime/include/iec_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <type_traits>
#include "iec_types.hpp"
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/include/iec_subrange.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include "iec_var.hpp"

namespace strucpp {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/include/iec_time.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#pragma once

#include <cstdint>
#include <cmath>
#include "iec_platform.hpp"

#include "iec_types.hpp"

namespace strucpp {
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/include/iec_tod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

#pragma once

#include <cstdint>
#include "iec_platform.hpp"

#include "iec_types.hpp"

namespace strucpp {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/include/iec_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

#pragma once

#include "iec_platform.hpp"

#include <type_traits>
#include <cstdint>
#include <cstddef>
#include "iec_types.hpp"

namespace strucpp {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/include/iec_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#pragma once

#include <cstdint>
#include <cstddef>
#include "iec_platform.hpp"


namespace strucpp {

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/include/iec_wstring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

#pragma once

#include <cstdint>
#include <cstring>
#include "iec_platform.hpp"

#include <algorithm>
#include "iec_types.hpp"

Expand Down
Loading