patterns/includes: Update standard library and patterns to support the new bitfields (#102)

* Add `current_bit_offset()` and `read_bits(...)` to `std::mem`

* Replace deprecated BitfieldOrder enum values with new clearer names

This adds new options named `MostToLeastSignificant` and `LeastToMostSignificant` to replace the old `LeftToRight` and `RightToLeft` names. These names should be much clearer about what they affect and how.

* Throw errors when `std::core::(get|set)_bitfield_order()` are called

* Update all patterns to work with the new bitfield behaviors
This commit is contained in:
Zaggy1024
2023-04-01 04:16:54 -05:00
committed by GitHub
parent d42b87d9e6
commit 1cd7f92a5d
23 changed files with 2482 additions and 2433 deletions

View File

@@ -1,9 +1,12 @@
#pragma endian big
#pragma MIME application/x-java-applet
#include <std/core.pat>
#include <std/io.pat>
#include <std/sys.pat>
using BitfieldOrder = std::core::BitfieldOrder;
// The Java documentations use the number of bytes instead of the number of bits for its type names
using u1 = u8;
using u2 = u16;
@@ -206,7 +209,7 @@ bitfield access_flags_method {
padding : 1; // 0x2000
padding : 1; // 0x4000
padding : 1; // 0x8000
};
} [[bitfield_order(BitfieldOrder::LeastToMostSignificant, 16)]];
bitfield access_flags_field {
ACC_PUBLIC : 1; // 0x0001
@@ -225,7 +228,7 @@ bitfield access_flags_field {
padding : 1; // 0x2000
ACC_ENUM : 1; // 0x4000
padding : 1; // 0x8000
};
} [[bitfield_order(BitfieldOrder::LeastToMostSignificant, 16)]];
bitfield access_flags_class {
ACC_PUBLIC : 1; // 0x0001
@@ -244,7 +247,7 @@ bitfield access_flags_class {
ACC_ANNOTATION : 1; // 0x2000
ACC_ENUM : 1; // 0x4000
ACC_MODULE : 1; // 0x8000
};
} [[bitfield_order(BitfieldOrder::LeastToMostSignificant, 16)]];
struct attribute_info {
u2 attribute_name_info;