diff --git a/includes/hex/core.pat b/includes/hex/core.pat index 6ab2d5a..ff2ac72 100644 --- a/includes/hex/core.pat +++ b/includes/hex/core.pat @@ -1,12 +1,12 @@ #pragma once -#include +import hex.impl.imhex_check; /*! Core intrinsic functions to interact with the ImHex Hex Editor */ -namespace hex::core { +namespace auto hex::core { /** A type representing a selection in the hex editor diff --git a/includes/hex/dec.pat b/includes/hex/dec.pat index 89115f2..7250fc7 100644 --- a/includes/hex/dec.pat +++ b/includes/hex/dec.pat @@ -1,14 +1,14 @@ #pragma once -#include +import hex.impl.imhex_check; -#include +import std.mem; /*! Library to allow decoding of more complex values */ -namespace hex::dec { +namespace auto hex::dec { /** Demangles a mangled name into a human readable name diff --git a/includes/hex/http.pat b/includes/hex/http.pat index 8d0ec5b..ed60d1a 100644 --- a/includes/hex/http.pat +++ b/includes/hex/http.pat @@ -1,12 +1,12 @@ #pragma once -#include +import hex.impl.imhex_check; /*! Library to do HTTP requests */ -namespace hex::http { +namespace auto hex::http { /** Performs a HTTP GET request to the given URL and returns the response body diff --git a/includes/hex/provider.pat b/includes/hex/provider.pat index b042fdb..ab046d5 100644 --- a/includes/hex/provider.pat +++ b/includes/hex/provider.pat @@ -1,12 +1,12 @@ #pragma once -#include +import hex.impl.imhex_check; /*! Library to interact with the currently loaded provider. */ -namespace hex::prv { +namespace auto hex::prv { /** diff --git a/includes/hex/type/mangled.pat b/includes/hex/type/mangled.pat index c42e72d..e85de6e 100644 --- a/includes/hex/type/mangled.pat +++ b/includes/hex/type/mangled.pat @@ -1,16 +1,16 @@ #pragma once -#include -#include +import std.io; +import std.mem; -#include -#include +import hex.impl.imhex_check; +import hex.dec; /*! Types to automatically decode mangled names */ -namespace hex::type { +namespace auto hex::type { /** A mangled name string that gets demangled when displayed diff --git a/includes/std/array.pat b/includes/std/array.pat index c4fa350..f3f4870 100644 --- a/includes/std/array.pat +++ b/includes/std/array.pat @@ -1,13 +1,13 @@ #pragma once -#include +import std.sys; /*! The array library contains a helper type to make it easier to create multi-dimensional arrays and pass arrays to functions as parameters. */ -namespace std { +namespace auto std { /** Simple one dimensional array wrapper diff --git a/includes/std/bit.pat b/includes/std/bit.pat index 09b7c5a..46cbe2c 100644 --- a/includes/std/bit.pat +++ b/includes/std/bit.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.limits; /*! This library contains various helper functions for common bit operations. */ -namespace std::bit { +namespace auto std::bit { /** Calculates the number of 1 bits in a given number diff --git a/includes/std/core.pat b/includes/std/core.pat index fbf42fb..f44104c 100644 --- a/includes/std/core.pat +++ b/includes/std/core.pat @@ -1,13 +1,13 @@ #pragma once -#include +import std.mem; /*! The core library contains intrinsics and "compiler magic" functions that get extra help from the runtime to fulfill their purpose. */ -namespace std::core { +namespace auto std::core { /** The layout order of each field after byte-endianness has been handled. diff --git a/includes/std/ctype.pat b/includes/std/ctype.pat index 1417718..30f1881 100644 --- a/includes/std/ctype.pat +++ b/includes/std/ctype.pat @@ -5,7 +5,7 @@ of ASCII characters. */ -namespace std::ctype { +namespace auto std::ctype { /** Checks if the given character `c` is a digit between '0' and '9' diff --git a/includes/std/file.pat b/includes/std/file.pat index 3e221de..e441342 100644 --- a/includes/std/file.pat +++ b/includes/std/file.pat @@ -7,7 +7,7 @@ **These functions are considered dangerous and require the user to manually permit them** */ -namespace std::file { +namespace auto std::file { /** A handle representing a file that has been opened diff --git a/includes/std/fxpt.pat b/includes/std/fxpt.pat index 8af08cf..ca00343 100644 --- a/includes/std/fxpt.pat +++ b/includes/std/fxpt.pat @@ -4,7 +4,7 @@ Library for doing arithmetic with fixed point numbers and converting them from/to floating point numbers. */ -namespace std::fxpt { +namespace auto std::fxpt { /** A fixed point value diff --git a/includes/std/hash.pat b/includes/std/hash.pat index 175b30f..e6c3817 100644 --- a/includes/std/hash.pat +++ b/includes/std/hash.pat @@ -4,7 +4,7 @@ The hash library contains various data hash functions */ -namespace std::hash { +namespace auto std::hash { /** Calculates the CRC32 hash of the bytes inside of a given pattern diff --git a/includes/std/io.pat b/includes/std/io.pat index 816c588..95f135d 100644 --- a/includes/std/io.pat +++ b/includes/std/io.pat @@ -4,7 +4,7 @@ The IO library allows formatting strings and outputting text to the console */ -namespace std { +namespace auto std { /** Formats the given arguments using the format string and prints the result to the console diff --git a/includes/std/limits.pat b/includes/std/limits.pat index eeb4741..9a13add 100644 --- a/includes/std/limits.pat +++ b/includes/std/limits.pat @@ -4,7 +4,7 @@ Library to calculate the minimum and maximum values that fit into a given data type */ -namespace std::limits { +namespace auto std::limits { /** Returns the minimum value that can be stored in a `u8`. diff --git a/includes/std/math.pat b/includes/std/math.pat index 1ec54a8..acc846f 100644 --- a/includes/std/math.pat +++ b/includes/std/math.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.mem; /*! Library containing more advanced mathematical operations. */ -namespace std::math { +namespace auto std::math { /** Compares the values `a` and `b` with each other and returns the smaller of the two diff --git a/includes/std/mem.pat b/includes/std/mem.pat index 855e94c..d239cc4 100644 --- a/includes/std/mem.pat +++ b/includes/std/mem.pat @@ -4,7 +4,7 @@ Library for doing raw memory accesses and other low-level operations. */ -namespace std::mem { +namespace auto std::mem { namespace impl { diff --git a/includes/std/ptr.pat b/includes/std/ptr.pat index 2816ed5..963ce4b 100644 --- a/includes/std/ptr.pat +++ b/includes/std/ptr.pat @@ -1,13 +1,13 @@ #pragma once -#include +import std.mem; /*! The Pointer library contains helper functions to deal with pointer types. The `relative_to` functions are meant to be used with the `[[pointer_base]]` attribute */ -namespace std::ptr { +namespace auto std::ptr { /** Use the offset of the current pointer as start address diff --git a/includes/std/random.pat b/includes/std/random.pat index f371212..a5bdb90 100644 --- a/includes/std/random.pat +++ b/includes/std/random.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.limits; /*! Library to generate random numbers. Supports various different distribution types. */ -namespace std::random { +namespace auto std::random { /** Represents the type of distribution to use to generate a random number diff --git a/includes/std/string.pat b/includes/std/string.pat index dbe6043..99ee308 100644 --- a/includes/std/string.pat +++ b/includes/std/string.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.io; /*! Libray to interact with strings. */ -namespace std::string { +namespace auto std::string { /** Base type for sized strings. Represents a string with its size preceeding it. diff --git a/includes/std/sys.pat b/includes/std/sys.pat index fc81a73..cc088f7 100644 --- a/includes/std/sys.pat +++ b/includes/std/sys.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.io; /*! Basic helper functions */ -namespace std { +namespace auto std { /** Asserts that a given value is true. If it's not, abort evaluation and print the given message to the console diff --git a/includes/std/time.pat b/includes/std/time.pat index aee0ab4..243b4c8 100644 --- a/includes/std/time.pat +++ b/includes/std/time.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.io; /*! Library to handle time and date related operations. */ -namespace std::time { +namespace auto std::time { /** A structured representation of a time and date. diff --git a/includes/type/base.pat b/includes/type/base.pat index d24fec4..4b44b1d 100644 --- a/includes/type/base.pat +++ b/includes/type/base.pat @@ -1,14 +1,14 @@ #pragma once -#include -#include +import std.io; +import std.math; /*! Types used to change the base of the displayed integer value. Used like `type::Hex hexNumber;`, `type::Oct octalNumber;` */ -namespace type { +namespace auto type { /** Integer type representing a Hexadecimal value. Displays its value in hexadecimal format. diff --git a/includes/type/base64.pat b/includes/type/base64.pat index 1d3f6fc..5f4f171 100644 --- a/includes/type/base64.pat +++ b/includes/type/base64.pat @@ -1,12 +1,12 @@ -#include -#include -#include +import std.io; +import std.string; +import std.mem; /*! Type representing a Base64 encoded string */ -namespace type { +namespace auto type { /** Type representing a Base64 encoded string diff --git a/includes/type/bcd.pat b/includes/type/bcd.pat index 56c72a8..834e59c 100644 --- a/includes/type/bcd.pat +++ b/includes/type/bcd.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.io; /*! Type to decode a BCD (Binary Coded Decimal) number */ -namespace type { +namespace auto type { /** Decodes a BCD value where one byte represents a single digit diff --git a/includes/type/byte.pat b/includes/type/byte.pat index 09790e2..7e3f8a5 100644 --- a/includes/type/byte.pat +++ b/includes/type/byte.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.io; /*! Types to display single bytes using various different representations */ -namespace type { +namespace auto type { /** Type visualizing the value of each individual bit diff --git a/includes/type/color.pat b/includes/type/color.pat index 922aa83..35b2b17 100644 --- a/includes/type/color.pat +++ b/includes/type/color.pat @@ -1,13 +1,13 @@ #pragma once -#include -#include +import std.io; +import std.core; /*! Types representing RGB or RGBA colors. The decoded color will be displayed in their color field */ -namespace type { +namespace auto type { /** Type representing a generic RGBA color with a variable number of bits for each color diff --git a/includes/type/float16.pat b/includes/type/float16.pat index e9f49e5..5a2cfa4 100644 --- a/includes/type/float16.pat +++ b/includes/type/float16.pat @@ -1,14 +1,14 @@ #pragma once -#include -#include -#include +import std.io; +import std.math; +import std.mem; /*! Type representing a 16 bit half precision floating point number */ -namespace type { +namespace auto type { /** Type representing a 16 bit half precision floating point number diff --git a/includes/type/guid.pat b/includes/type/guid.pat index bcc601f..32a04fe 100644 --- a/includes/type/guid.pat +++ b/includes/type/guid.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.io; /*! Types to deal with UUIDs (Universally Unique Identifiers) / GUIDs (Globally Unique Identifiers) as described in RFC 4122 */ -namespace type { +namespace auto type { /** Type representing a GUID value diff --git a/includes/type/ip.pat b/includes/type/ip.pat index 781bc43..ef059d9 100644 --- a/includes/type/ip.pat +++ b/includes/type/ip.pat @@ -1,13 +1,13 @@ #pragma once -#include -#include +import std.io; +import std.string; /*! Types used to decode IP addresses */ -namespace type { +namespace auto type { /** A 4 byte IPv4 Address as described in RFC 791 diff --git a/includes/type/leb128.pat b/includes/type/leb128.pat index 2339f70..c292a5b 100644 --- a/includes/type/leb128.pat +++ b/includes/type/leb128.pat @@ -1,13 +1,13 @@ #pragma once -#include -#include +import std.io; +import std.mem; /*! Types used to decode Little Endian Base 128 numbers used to store large numbers as space efficiently as possible */ -namespace type { +namespace auto type { /** Base LEB128 type. Use `uLEB128` and `sLEB128` instead. diff --git a/includes/type/mac.pat b/includes/type/mac.pat index 48fe237..9592005 100644 --- a/includes/type/mac.pat +++ b/includes/type/mac.pat @@ -1,12 +1,12 @@ #pragma once -#include +import std.io; /*! Types used to decode MAC Addresses */ -namespace type { +namespace auto type { /** A MAC Address as used in the Internet Protocol diff --git a/includes/type/magic.pat b/includes/type/magic.pat index 9a1f34c..489e5ea 100644 --- a/includes/type/magic.pat +++ b/includes/type/magic.pat @@ -1,13 +1,13 @@ -#include -#include -#include -#include +import std.string; +import std.sys; +import std.io; +import std.ctype; /*! Types used to parse and enforce specific magic numbers */ -namespace type +namespace auto type { fn fm(ref auto value) { diff --git a/includes/type/path.pat b/includes/type/path.pat index d445fdd..fa8cb3d 100644 --- a/includes/type/path.pat +++ b/includes/type/path.pat @@ -1,10 +1,10 @@ -#include +import std.mem; /*! Types dealing with various kinds of resource paths */ -namespace type { +namespace auto type { /** Type representing a single path segment. Use the `Path` type instead of using this on its own diff --git a/includes/type/size.pat b/includes/type/size.pat index 25d0655..f2231d0 100644 --- a/includes/type/size.pat +++ b/includes/type/size.pat @@ -1,10 +1,10 @@ -#include +import std.io; /*! Types used to pretty print size values */ -namespace type { +namespace auto type { /** A generic size type which displays its value in Bytes (or kiB, MiB, GiB, TiB, PiB, EiB if larger) diff --git a/includes/type/time.pat b/includes/type/time.pat index 180bbaa..031cad2 100644 --- a/includes/type/time.pat +++ b/includes/type/time.pat @@ -1,13 +1,13 @@ #pragma once -#include -#include +import std.io; +import std.time; /*! Types used to decode various different time formats */ -namespace type { +namespace auto type { /** A 32 bit Unix time value diff --git a/includes/type/types/010.pat b/includes/type/types/010.pat index 0aa6c3b..7dec85f 100644 --- a/includes/type/types/010.pat +++ b/includes/type/types/010.pat @@ -5,7 +5,7 @@ */ // Explicitly don't add these types to the `type` namespace for usability -// namespace type { +// namespace auto type { // using char = s8; using byte = s8; diff --git a/includes/type/types/c.pat b/includes/type/types/c.pat index fbb2dd9..62eedd0 100644 --- a/includes/type/types/c.pat +++ b/includes/type/types/c.pat @@ -5,7 +5,7 @@ */ // Explicitly don't add these types to the `type` namespace for usability -// namespace type { +// namespace auto type { using uint8_t = u8; using uint16_t = u16; diff --git a/includes/type/types/linux.pat b/includes/type/types/linux.pat index 102d836..378826e 100644 --- a/includes/type/types/linux.pat +++ b/includes/type/types/linux.pat @@ -5,7 +5,7 @@ */ // Explicitly don't add these types to the `type` namespace for usability -// namespace type { +// namespace auto type { using le16 = le u16; using be16 = be u16; diff --git a/includes/type/types/rust.pat b/includes/type/types/rust.pat index b91b48e..6870fa6 100644 --- a/includes/type/types/rust.pat +++ b/includes/type/types/rust.pat @@ -5,7 +5,7 @@ */ // Explicitly don't add these types to the `type` namespace for usability -// namespace type { +// namespace auto type { // using u8 = u8; // using u16 = u16; diff --git a/includes/type/types/win32.pat b/includes/type/types/win32.pat index 2646690..b1538a9 100644 --- a/includes/type/types/win32.pat +++ b/includes/type/types/win32.pat @@ -5,7 +5,7 @@ */ // Explicitly don't add these types to the `type` namespace for usability -// namespace type { +// namespace auto type { using BYTE = u8; using WORD = u16; diff --git a/patterns/3ds.hexpat b/patterns/3ds.hexpat index 964eaa5..6fafde4 100644 --- a/patterns/3ds.hexpat +++ b/patterns/3ds.hexpat @@ -1,8 +1,8 @@ #pragma author WerWolv #pragma description Autodesk 3DS Max Model file -#include -#include +import std.io; +import type.base; #pragma MIME image/x-3ds diff --git a/patterns/7z.hexpat b/patterns/7z.hexpat index bda9ae3..eeecaf4 100644 --- a/patterns/7z.hexpat +++ b/patterns/7z.hexpat @@ -1,8 +1,8 @@ #pragma description 7z File Format -#include -#include -#include +import std.io; +import std.mem; +import std.math; enum Type:u8{ diff --git a/patterns/Crashlvl.hexpat b/patterns/Crashlvl.hexpat index e903ad8..4bb69d3 100644 --- a/patterns/Crashlvl.hexpat +++ b/patterns/Crashlvl.hexpat @@ -2,9 +2,9 @@ #pragma description Crash Bandicoot - Back in Time (fan game) User created level format // Supports all versions till 0.94c, newer versions might be compatible! -#include -#include -#include +import type.magic; +import std.string; +import std.array; struct Header { diff --git a/patterns/afe2.hexpat b/patterns/afe2.hexpat index 80fd614..9b70798 100644 --- a/patterns/afe2.hexpat +++ b/patterns/afe2.hexpat @@ -3,8 +3,8 @@ #pragma endian little -#include -#include +import std.io; +import std.sys; #define ATMOSPHERE_REBOOT_TO_FATAL_MAGIC "AFE2" #define ATMOSPHERE_REBOOT_TO_FATAL_MAGIC_1 "AFE1" diff --git a/patterns/ar.hexpat b/patterns/ar.hexpat index 1c95964..2549bde 100644 --- a/patterns/ar.hexpat +++ b/patterns/ar.hexpat @@ -3,9 +3,9 @@ #pragma MIME application/x-archive -#include -#include -#include +import std.string; +import std.mem; +import std.sys; struct ARFile { char file_name[16]; diff --git a/patterns/arm_cm_vtor.hexpat b/patterns/arm_cm_vtor.hexpat index d95f7e5..d7047d2 100644 --- a/patterns/arm_cm_vtor.hexpat +++ b/patterns/arm_cm_vtor.hexpat @@ -3,8 +3,8 @@ #pragma endian little -#include -#include +import std.io; +import std.mem; #define VTOR 0x00000000 #define EXTERNAL_INTERRUPT_COUNT 64 diff --git a/patterns/bencode.hexpat b/patterns/bencode.hexpat index 49f3b72..066754e 100644 --- a/patterns/bencode.hexpat +++ b/patterns/bencode.hexpat @@ -3,9 +3,9 @@ #pragma MIME application/x-bittorrent -#include -#include -#include +import std.ctype; +import std.mem; +import std.string; namespace bencode { diff --git a/patterns/bmp.hexpat b/patterns/bmp.hexpat index 861acba..58e8e27 100644 --- a/patterns/bmp.hexpat +++ b/patterns/bmp.hexpat @@ -2,7 +2,7 @@ #pragma MIME image/bmp #pragma endian little -#include +import std.mem; struct BitmapFileHeader { u8 bfType[2]; diff --git a/patterns/bplist.hexpat b/patterns/bplist.hexpat index 85b44fe..268bb42 100644 --- a/patterns/bplist.hexpat +++ b/patterns/bplist.hexpat @@ -1,7 +1,7 @@ -#include -#include -#include -#include +import std.math; +import std.core; +import type.magic; +import type.time; using CFBinaryPlistObject; diff --git a/patterns/bson.hexpat b/patterns/bson.hexpat index 53caf77..5303543 100644 --- a/patterns/bson.hexpat +++ b/patterns/bson.hexpat @@ -3,8 +3,8 @@ #pragma MIME application/bson -#include -#include +import std.mem; +import type.time; enum Type : u8 { Double = 0x01, diff --git a/patterns/bsp_goldsrc.hexpat b/patterns/bsp_goldsrc.hexpat index aa64771..678bb9b 100644 --- a/patterns/bsp_goldsrc.hexpat +++ b/patterns/bsp_goldsrc.hexpat @@ -1,8 +1,8 @@ #pragma description GoldSrc engine maps format (used in Half-Life 1) -#include -#include -#include +import std.ptr; +import std.mem; +import std.sys; #pragma endian little diff --git a/patterns/chm.hexpat b/patterns/chm.hexpat index bb029c2..7d0b3fd 100644 --- a/patterns/chm.hexpat +++ b/patterns/chm.hexpat @@ -1,11 +1,11 @@ #pragma author WerWolv #pragma description Windows HtmlHelp Data (ITSF / CHM) -#include -#include -#include -#include -#include +import type.magic; +import type.size; +import type.guid; +import type.leb128; +import std.sys; enum WindowsLanguageId : u32 { Arabic_SaudiArabia = 0x401, diff --git a/patterns/coff.hexpat b/patterns/coff.hexpat index 9b34139..9c9af1b 100644 --- a/patterns/coff.hexpat +++ b/patterns/coff.hexpat @@ -3,8 +3,8 @@ #pragma MIME application/x-coff -#include -#include +import type.time; +import type.size; enum Machine : u16 { Unknown = 0x0000, diff --git a/patterns/cpio.hexpat b/patterns/cpio.hexpat index dca9c3b..fa2b693 100644 --- a/patterns/cpio.hexpat +++ b/patterns/cpio.hexpat @@ -1,12 +1,12 @@ #pragma author WerWolv #pragma description Old Binary CPIO Format -#include +import type.base; -#include -#include -#include -#include +import std.time; +import std.core; +import std.sys; +import std.mem; #pragma MIME application/x-cpio diff --git a/patterns/dex.hexpat b/patterns/dex.hexpat index ba8d340..123da76 100644 --- a/patterns/dex.hexpat +++ b/patterns/dex.hexpat @@ -1,6 +1,6 @@ #pragma description Dalvik EXecutable Format -#include +import type.leb128; struct header_item { u8 magic[8]; diff --git a/patterns/dicom.hexpat b/patterns/dicom.hexpat index c15a1fd..a98517b 100644 --- a/patterns/dicom.hexpat +++ b/patterns/dicom.hexpat @@ -3,12 +3,12 @@ #pragma MIME application/dicom #pragma endian little -#include -#include -#include -#include -#include -#include +import std.core; +import std.io; +import std.mem; +import std.string; +import std.sys; +import type.magic; u32 UNDEFINED_LENGTH = 0xffffffff; diff --git a/patterns/dmg.hexpat b/patterns/dmg.hexpat index ac1a58f..2b7d600 100644 --- a/patterns/dmg.hexpat +++ b/patterns/dmg.hexpat @@ -2,10 +2,10 @@ #pragma endian big -#include -#include -#include -#include +import type.magic; +import type.size; +import type.guid; +import std.mem; // Parse DMG Structure per http://newosxbook.com/DMG.html // diff --git a/patterns/dsstore.hexpat b/patterns/dsstore.hexpat index dde7193..04490b3 100644 --- a/patterns/dsstore.hexpat +++ b/patterns/dsstore.hexpat @@ -2,7 +2,7 @@ // Apple macOS .DS_Store format #pragma endian big -#include +import std.io; struct RecordEntry { u32 length; diff --git a/patterns/elf.hexpat b/patterns/elf.hexpat index c715133..be89e6b 100644 --- a/patterns/elf.hexpat +++ b/patterns/elf.hexpat @@ -7,9 +7,9 @@ #pragma MIME application/x-object #pragma MIME application/x-sharedlib -#include -#include -#include +import std.core; +import std.io; +import std.mem; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/patterns/fdt.hexpat b/patterns/fdt.hexpat index 4452dd6..f93c302 100644 --- a/patterns/fdt.hexpat +++ b/patterns/fdt.hexpat @@ -3,12 +3,12 @@ #pragma endian big -#include -#include -#include +import std.sys; +import std.io; +import std.core; -#include -#include +import type.magic; +import type.size; // These are used in order for the children to be able to find strings u64 fdt_addr; diff --git a/patterns/flac.hexpat b/patterns/flac.hexpat index d03c1fc..b974412 100644 --- a/patterns/flac.hexpat +++ b/patterns/flac.hexpat @@ -1,9 +1,9 @@ #pragma author WerWolv #pragma description Free Lossless Audio Codec, FLAC Audio Format -#include -#include -#include +import std.sys; +import std.core; +import std.io; #pragma endian big diff --git a/patterns/fs.hexpat b/patterns/fs.hexpat index e721746..6b3a169 100644 --- a/patterns/fs.hexpat +++ b/patterns/fs.hexpat @@ -1,7 +1,7 @@ #pragma author WerWolv #pragma description Drive File System -#include +import std.io; struct DiskTimeStamp { u8 seconds, minutes, hours; diff --git a/patterns/gb.hexpat b/patterns/gb.hexpat index 132e018..947ac98 100644 --- a/patterns/gb.hexpat +++ b/patterns/gb.hexpat @@ -3,9 +3,9 @@ #pragma MIME application/x-gameboy-rom -#include -#include -#include +import type.size; +import std.string; +import std.mem; bool uppercaseROMFeatures in; bool brandedROMFeatures in; diff --git a/patterns/gif.hexpat b/patterns/gif.hexpat index 92fce2c..ed57c22 100644 --- a/patterns/gif.hexpat +++ b/patterns/gif.hexpat @@ -13,13 +13,13 @@ #define EXTENSION_INTRODUCER_MAGIC 0x21 #define GIF_TRAILER_MAGIC 0x3B -#include -#include -#include -#include -#include +import std.io; +import std.core; +import std.mem; +import std.string; +import std.math; -#include +import type.magic; bitfield GCT_Flags { size : 3 [[comment("physical size = 2^(flags.size + 1)")]]; diff --git a/patterns/gltf.hexpat b/patterns/gltf.hexpat index bcd3fd0..27e43fd 100644 --- a/patterns/gltf.hexpat +++ b/patterns/gltf.hexpat @@ -22,8 +22,8 @@ * SOFTWARE. */ -#include -#include +import std.mem; +import std.io; /** * @brief The glTF magic section. diff --git a/patterns/gzip.hexpat b/patterns/gzip.hexpat index 74a4a12..66065ab 100644 --- a/patterns/gzip.hexpat +++ b/patterns/gzip.hexpat @@ -3,10 +3,10 @@ #pragma MIME application/gzip -#include -#include -#include -#include +import type.time; +import type.size; +import std.core; +import std.mem; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/patterns/hinf_bitmap.hexpat b/patterns/hinf_bitmap.hexpat index 3d59982..e23b7a8 100644 --- a/patterns/hinf_bitmap.hexpat +++ b/patterns/hinf_bitmap.hexpat @@ -1,6 +1,6 @@ -#include -#include -#include +import std.mem; +import std.io; +import std.string; struct Header { u32 magic; diff --git a/patterns/hinf_luas.hexpat b/patterns/hinf_luas.hexpat index 802e4df..7b7d655 100644 --- a/patterns/hinf_luas.hexpat +++ b/patterns/hinf_luas.hexpat @@ -1,10 +1,10 @@ #pragma author Surasia #pragma description Halo Infinite HavokScript 5.1 "luas" file -#include -#include -#include -#include +import std.io; +import std.mem; +import std.core; +import std.string; struct String32 { s32 length; diff --git a/patterns/ico.hexpat b/patterns/ico.hexpat index 6795478..3875a16 100644 --- a/patterns/ico.hexpat +++ b/patterns/ico.hexpat @@ -3,7 +3,7 @@ #pragma endian little -#include +import std.sys; #pragma MIME image/vnd.microsoft.icon #pragma MIME image/x-icon diff --git a/patterns/id3.hexpat b/patterns/id3.hexpat index 183c205..b9a2aa2 100644 --- a/patterns/id3.hexpat +++ b/patterns/id3.hexpat @@ -2,7 +2,7 @@ #pragma MIME audio/mpeg -#include +import std.mem; namespace v1 { diff --git a/patterns/intel_hex.hexpat b/patterns/intel_hex.hexpat index 732beb3..0edee8f 100644 --- a/patterns/intel_hex.hexpat +++ b/patterns/intel_hex.hexpat @@ -8,7 +8,7 @@ */ #pragma endian big -#include +import std.mem; enum FileType: u16 { Data = 0x3030, diff --git a/patterns/ip.hexpat b/patterns/ip.hexpat index 9f0599d..1b556cb 100644 --- a/patterns/ip.hexpat +++ b/patterns/ip.hexpat @@ -3,8 +3,8 @@ #pragma endian big -#include -#include +import std.sys; +import std.io; struct MAC { u8 octets[6]; diff --git a/patterns/ips.hexpat b/patterns/ips.hexpat index 8ca78d1..b608286 100644 --- a/patterns/ips.hexpat +++ b/patterns/ips.hexpat @@ -3,8 +3,8 @@ #pragma endian big -#include -#include +import std.mem; +import std.string; struct Hunk { u24 offset; diff --git a/patterns/iso.hexpat b/patterns/iso.hexpat index 34f1b74..b1983f7 100644 --- a/patterns/iso.hexpat +++ b/patterns/iso.hexpat @@ -2,7 +2,7 @@ #pragma endian little -#include +import std.io; enum VolumeDescriptorTypes : u8 { BootRecord, diff --git a/patterns/java_class.hexpat b/patterns/java_class.hexpat index aede666..226fc10 100644 --- a/patterns/java_class.hexpat +++ b/patterns/java_class.hexpat @@ -5,11 +5,11 @@ #pragma pattern_limit 100000000 #pragma MIME application/x-java-applet -#include -#include -#include -#include -#include +import std.string; +import std.math; +import std.core; +import std.io; +import std.sys; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/patterns/jpeg.hexpat b/patterns/jpeg.hexpat index 6e0c542..8b42db3 100644 --- a/patterns/jpeg.hexpat +++ b/patterns/jpeg.hexpat @@ -1,9 +1,9 @@ #pragma author WerWolv #pragma description JPEG Image Format -#include -#include -#include +import std.io; +import std.mem; +import type.magic; #pragma endian big #pragma MIME image/jpeg diff --git a/patterns/lnk.hexpat b/patterns/lnk.hexpat index 54a1d5e..fd3c85f 100644 --- a/patterns/lnk.hexpat +++ b/patterns/lnk.hexpat @@ -3,9 +3,9 @@ #pragma MIME application/x-ms-shortcut -#include -#include -#include +import std.core; +import type.guid; +import type.size; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/patterns/lua54.hexpat b/patterns/lua54.hexpat index 46208a4..a75393a 100644 --- a/patterns/lua54.hexpat +++ b/patterns/lua54.hexpat @@ -1,7 +1,7 @@ #pragma description Lua 5.4 bytecode -#include -#include +import std.io; +import std.mem; namespace impl { diff --git a/patterns/macho.hexpat b/patterns/macho.hexpat index d01e7e0..b72911e 100644 --- a/patterns/macho.hexpat +++ b/patterns/macho.hexpat @@ -3,7 +3,7 @@ #pragma MIME application/x-mach-binary -#include +import type.size; enum Magic : u32 { _32BitMagic = 0xFEEDFACE, diff --git a/patterns/max_v104.hexpat b/patterns/max_v104.hexpat index f5f8a1a..6018177 100644 --- a/patterns/max_v104.hexpat +++ b/patterns/max_v104.hexpat @@ -1,7 +1,7 @@ #pragma description Mechanized Assault and Exploration v1.04 (strategy game) save file format -#include -#include +import std.sys; +import std.mem; #pragma array_limit 12544 #pragma pattern_limit 2000000 diff --git a/patterns/midi.hexpat b/patterns/midi.hexpat index 1711add..265586a 100644 --- a/patterns/midi.hexpat +++ b/patterns/midi.hexpat @@ -1,6 +1,6 @@ #pragma description MIDI header, event fields provided -#include +import std.core; #pragma MIME audio/midi #pragma endian big diff --git a/patterns/minidump.hexpat b/patterns/minidump.hexpat index 584ba4e..31cb0fd 100644 --- a/patterns/minidump.hexpat +++ b/patterns/minidump.hexpat @@ -3,9 +3,9 @@ #pragma MIME application/x-dmp -#include -#include -#include +import type.time; +import type/types.win32; +import type.size; using RVA = ULONG32; using RVA64 = ULONG64; diff --git a/patterns/mp4.hexpat b/patterns/mp4.hexpat index ab362fb..07f99ed 100644 --- a/patterns/mp4.hexpat +++ b/patterns/mp4.hexpat @@ -6,9 +6,9 @@ #pragma MIME video/mp4 #pragma MIME application/mp4 -#include -#include -#include +import std.io; +import std.mem; +import std.string; fn to_string(auto var) { return str(var); diff --git a/patterns/nacp.hexpat b/patterns/nacp.hexpat index 039ab83..0f71987 100644 --- a/patterns/nacp.hexpat +++ b/patterns/nacp.hexpat @@ -3,8 +3,8 @@ #pragma endian little -#include -#include +import std.sys; +import std.io; struct ApplicationTitle { char name[0x200]; diff --git a/patterns/nbt.hexpat b/patterns/nbt.hexpat index ff1c2cf..00b6b2a 100644 --- a/patterns/nbt.hexpat +++ b/patterns/nbt.hexpat @@ -1,7 +1,7 @@ #pragma author WerWolv #pragma description Minecraft NBT format -#include +import std.sys; #pragma endian big diff --git a/patterns/ne.hexpat b/patterns/ne.hexpat index 62b1a7b..2101321 100644 --- a/patterns/ne.hexpat +++ b/patterns/ne.hexpat @@ -1,6 +1,6 @@ #pragma description NE header and Standard NE fields -#include +import std.mem; struct DOSHeader { char signature[2]; diff --git a/patterns/nes.hexpat b/patterns/nes.hexpat index b5c68c3..eeb861a 100644 --- a/patterns/nes.hexpat +++ b/patterns/nes.hexpat @@ -1,8 +1,8 @@ #pragma author gmestanley #pragma description .nes file format -#include -#include +import std.mem; +import std.string; bitfield iNES07Flags { mirroringIsVertical : 1; diff --git a/patterns/nro.hexpat b/patterns/nro.hexpat index 8917f32..1884192 100644 --- a/patterns/nro.hexpat +++ b/patterns/nro.hexpat @@ -1,8 +1,8 @@ #pragma author WerWolv #pragma description Nintendo Switch NRO files -#include -#include +import std.io; +import std.sys; struct MOD0 { char magic[4]; diff --git a/patterns/ntag.hexpat b/patterns/ntag.hexpat index 3b20dcb..9aadc15 100644 --- a/patterns/ntag.hexpat +++ b/patterns/ntag.hexpat @@ -1,7 +1,7 @@ #pragma author WerWolv #pragma description NTAG213/NTAG215/NTAG216, NFC Forum Type 2 Tag compliant IC -#include +import std.core; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/patterns/ogg.hexpat b/patterns/ogg.hexpat index 2917dcc..646347d 100644 --- a/patterns/ogg.hexpat +++ b/patterns/ogg.hexpat @@ -3,8 +3,8 @@ #pragma MIME audio/ogg -#include -#include +import std.core; +import std.mem; bitfield HeaderType { Continuation : 1; diff --git a/patterns/pbz.hexpat b/patterns/pbz.hexpat index c2565b0..1578a82 100644 --- a/patterns/pbz.hexpat +++ b/patterns/pbz.hexpat @@ -6,8 +6,8 @@ // // SPDX-License-Identifier: GPL-2.0-or-later -#include -#include +import std.mem; +import type.magic; #pragma endian big diff --git a/patterns/pcap.hexpat b/patterns/pcap.hexpat index 945b81c..33b60af 100644 --- a/patterns/pcap.hexpat +++ b/patterns/pcap.hexpat @@ -1,6 +1,6 @@ #pragma description pcap header and packets -#include +import std.mem; #pragma MIME application/vnd.tcpdump.pcap enum network_type : u32 { diff --git a/patterns/pcx.hexpat b/patterns/pcx.hexpat index 7a8fbce..a531093 100644 --- a/patterns/pcx.hexpat +++ b/patterns/pcx.hexpat @@ -3,7 +3,7 @@ #pragma MIME application/x-pcx -#include +import std.io; enum Encoding : u8 { NoEncoding = 0x00, diff --git a/patterns/pe.hexpat b/patterns/pe.hexpat index 74ea4e2..3aff4c9 100644 --- a/patterns/pe.hexpat +++ b/patterns/pe.hexpat @@ -5,10 +5,10 @@ #pragma MIME application/x-msdownload #pragma MIME application/vnd.microsoft.portable-executable -#include -#include -#include -#include +import std.core; +import std.string; +import type.guid; +import type.time; struct DOSHeader { char signature[2] [[hex::spec_name("e_magic")]]; diff --git a/patterns/pfs0.hexpat b/patterns/pfs0.hexpat index 2ff52b4..12112db 100644 --- a/patterns/pfs0.hexpat +++ b/patterns/pfs0.hexpat @@ -1,10 +1,10 @@ #pragma author WerWolv #pragma description Nintendo Switch PFS0 archive (NSP files) -#include -#include +import type.magic; +import type.size; -#include +import std.core; struct FileEntry { u64 dataOffset; diff --git a/patterns/png.hexpat b/patterns/png.hexpat index 4e9c627..9550fc8 100644 --- a/patterns/png.hexpat +++ b/patterns/png.hexpat @@ -3,7 +3,7 @@ #pragma MIME image/png #pragma endian big -#include +import std.mem; struct header_t { u8 highBitByte; diff --git a/patterns/protobuf.hexpat b/patterns/protobuf.hexpat index 04b6f94..4e8b3af 100644 --- a/patterns/protobuf.hexpat +++ b/patterns/protobuf.hexpat @@ -1,10 +1,10 @@ #pragma author WerWolv #pragma description Google Protobuf encoding -#include -#include +import std.core; +import std.mem; -#include +import type.leb128; struct ZigZag32 { u32 value; diff --git a/patterns/pyc.hexpat b/patterns/pyc.hexpat index 2c68249..0fb351b 100644 --- a/patterns/pyc.hexpat +++ b/patterns/pyc.hexpat @@ -1,7 +1,7 @@ #pragma description Python bytecode files -#include -#include +import type.time; +import std.mem; #define FLAG_REF 0x80 #define TYPE_NULL '0' diff --git a/patterns/pyinstaller.hexpat b/patterns/pyinstaller.hexpat index ced1801..03089f7 100644 --- a/patterns/pyinstaller.hexpat +++ b/patterns/pyinstaller.hexpat @@ -2,7 +2,7 @@ #pragma endian big -#include +import std.mem; // Reference: // https://pyinstaller.org/en/stable/advanced-topics.html diff --git a/patterns/qoi.hexpat b/patterns/qoi.hexpat index 6bcd3d2..111a92a 100644 --- a/patterns/qoi.hexpat +++ b/patterns/qoi.hexpat @@ -3,7 +3,7 @@ #pragma MIME image/qoi #pragma endian big -#include +import std.mem; namespace qoi { diff --git a/patterns/ras.hexpat b/patterns/ras.hexpat index a2709a9..54383f5 100644 --- a/patterns/ras.hexpat +++ b/patterns/ras.hexpat @@ -4,8 +4,8 @@ #pragma endian big -#include -#include +import std.mem; +import type.magic; struct RAS{ diff --git a/patterns/selinux.hexpat b/patterns/selinux.hexpat index f6537f5..27af45a 100644 --- a/patterns/selinux.hexpat +++ b/patterns/selinux.hexpat @@ -1,7 +1,7 @@ #pragma description SE Linux modules #pragma author Ange Albertini -#include +import std.sys; #pragma pattern_limit 13107200 #pragma array_limit 13107200 #pragma endian little diff --git a/patterns/selinuxpp.hexpat b/patterns/selinuxpp.hexpat index afab6ac..6d0d3a5 100644 --- a/patterns/selinuxpp.hexpat +++ b/patterns/selinuxpp.hexpat @@ -5,7 +5,7 @@ // https://github.com/SELinuxProject/selinux/blob/master/libsepol/src/module.c #pragma endian little -#include +import std.sys; enum section_types : u32 { file_context = 0xf97cff90, diff --git a/patterns/sit5.hexpat b/patterns/sit5.hexpat index 7b33435..105b84e 100644 --- a/patterns/sit5.hexpat +++ b/patterns/sit5.hexpat @@ -6,8 +6,8 @@ #pragma endian big #pragma MIME application/x-stuffit -#include -#include +import std.io; +import std.time; namespace v5 { diff --git a/patterns/spirv.hexpat b/patterns/spirv.hexpat index 0120cbf..b6f35a0 100644 --- a/patterns/spirv.hexpat +++ b/patterns/spirv.hexpat @@ -1,6 +1,6 @@ #pragma description SPIR-V header and instructions -#include +import std.mem; enum GeneratorID : u16 { Khronos = 0, diff --git a/patterns/stl.hexpat b/patterns/stl.hexpat index be85c0d..ee52ce4 100644 --- a/patterns/stl.hexpat +++ b/patterns/stl.hexpat @@ -6,9 +6,9 @@ #pragma MIME model/x.stl-ascii #pragma MIME application/sla -#include -#include -#include +import std.sys; +import std.mem; +import std.core; struct Vector3f { float x, y, z; diff --git a/patterns/swf.hexpat b/patterns/swf.hexpat index 83ef30f..26d3bbb 100644 --- a/patterns/swf.hexpat +++ b/patterns/swf.hexpat @@ -1,7 +1,7 @@ #pragma author saturnaliam #pragma description SWF file header #pragma endian little -#include +import type.magic; // RECTs are more complicated, but for the header, diff --git a/patterns/tar.hexpat b/patterns/tar.hexpat index 70ad5d7..278cb8b 100644 --- a/patterns/tar.hexpat +++ b/patterns/tar.hexpat @@ -5,10 +5,10 @@ #pragma endian little -#include -#include -#include -#include +import std.string; +import std.time; +import std.mem; +import std.sys; #define GNU_HEADER "ustar " diff --git a/patterns/tga.hexpat b/patterns/tga.hexpat index bee1325..93c6e8a 100644 --- a/patterns/tga.hexpat +++ b/patterns/tga.hexpat @@ -3,7 +3,7 @@ #pragma MIME image/tga #pragma endian little -#include +import std.mem; struct ColorMapSpec { u16 entryIndex; diff --git a/patterns/tiff.hexpat b/patterns/tiff.hexpat index 0ca3821..01df4d8 100644 --- a/patterns/tiff.hexpat +++ b/patterns/tiff.hexpat @@ -4,10 +4,10 @@ #pragma eval_depth 100 -#include -#include -#include -#include +import std.io; +import std.mem; +import std.string; +import std.core; char Magic[2] @ 0 [[hidden]]; match (Magic) { diff --git a/patterns/ubiquiti.hexpat b/patterns/ubiquiti.hexpat index bed493a..e34ce3e 100644 --- a/patterns/ubiquiti.hexpat +++ b/patterns/ubiquiti.hexpat @@ -2,8 +2,8 @@ #pragma endian big -#include -#include +import std.mem; +import std.sys; // Ubiquiti Firmware related structs // More information here: https://dl.ubnt.com/firmwares/XN-fw/v5.6.3/GPL.UBNT.v5.6.3.tar.bz2 diff --git a/patterns/uefi_boot_entry.hexpat b/patterns/uefi_boot_entry.hexpat index b6c4b1a..59756cc 100644 --- a/patterns/uefi_boot_entry.hexpat +++ b/patterns/uefi_boot_entry.hexpat @@ -4,8 +4,8 @@ #pragma author iTrooz #pragma description UEFI Boot Entry (Load option) -#include -#include +import std.io; +import type.guid; // subsection 10.3.5.1 struct HARD_DRIVE { diff --git a/patterns/uf2.hexpat b/patterns/uf2.hexpat index f3fdd75..cdfce05 100644 --- a/patterns/uf2.hexpat +++ b/patterns/uf2.hexpat @@ -1,8 +1,8 @@ #pragma author WerWolv #pragma description USB Flashing Format -#include -#include +import std.sys; +import std.mem; #pragma MIME application/microformats+json #pragma MIME application/microformats2+json diff --git a/patterns/usb.hexpat b/patterns/usb.hexpat index 8e45a88..9b0e8ce 100644 --- a/patterns/usb.hexpat +++ b/patterns/usb.hexpat @@ -1,7 +1,7 @@ -#include -#include -#include -#include +import std.core; +import std.io; +import std.mem; +import std.string; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/patterns/vbmeta.hexpat b/patterns/vbmeta.hexpat index 47f21b8..69f6d7c 100644 --- a/patterns/vbmeta.hexpat +++ b/patterns/vbmeta.hexpat @@ -1,7 +1,7 @@ #pragma description Android VBMeta image #pragma endian big -#include +import std.core; using uint8_t = u8; using uint32_t = u32; diff --git a/patterns/vdf.hexpat b/patterns/vdf.hexpat index 332eed2..18e09bd 100644 --- a/patterns/vdf.hexpat +++ b/patterns/vdf.hexpat @@ -3,8 +3,8 @@ #pragma eval_depth 0x10000 -#include -#include +import std.mem; +import std.sys; enum Type : u8 { Set = 0x00, diff --git a/patterns/vhdx.hexpat b/patterns/vhdx.hexpat index e2b4bb1..5f13a95 100644 --- a/patterns/vhdx.hexpat +++ b/patterns/vhdx.hexpat @@ -1,12 +1,12 @@ #pragma author WerWolv #pragma description Microsoft Hyper-V Virtual Hard Disk format -#include -#include -#include +import std.io; +import std.ptr; +import std.core; -#include -#include +import type.guid; +import type.size; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/patterns/wad.hexpat b/patterns/wad.hexpat index 68a6613..be3661d 100644 --- a/patterns/wad.hexpat +++ b/patterns/wad.hexpat @@ -1,8 +1,8 @@ #pragma author WerWolv #pragma description DOOM WAD Archive -#include -#include +import type.magic; +import type.size; enum WADType : char { Internal = 'I', diff --git a/patterns/was_oskasoftware.hexpat b/patterns/was_oskasoftware.hexpat index 976adce..eead619 100644 --- a/patterns/was_oskasoftware.hexpat +++ b/patterns/was_oskasoftware.hexpat @@ -2,7 +2,7 @@ #pragma description Oska Software DeskMates WAS/WA3 (WAVE/MP3 Set) file #pragma endian little -#include +import type.size; struct Sound { char name[]; diff --git a/patterns/wav.hexpat b/patterns/wav.hexpat index a4552b3..f04cb1b 100644 --- a/patterns/wav.hexpat +++ b/patterns/wav.hexpat @@ -3,7 +3,7 @@ #pragma MIME audio/x-wav #pragma MIME audio/wav -#include +import std.mem; struct RiffHeader { char ckID[4] [[comment("Container Signature"), name("RIFF Header Signature")]]; diff --git a/patterns/xbeh.hexpat b/patterns/xbeh.hexpat index 65ad54a..2ba70b2 100644 --- a/patterns/xbeh.hexpat +++ b/patterns/xbeh.hexpat @@ -3,12 +3,12 @@ #pragma MIME audio/x-xbox-executable -#include -#include -#include +import type.magic; +import type.size; +import type.time; -#include -#include +import std.io; +import std.mem; bitfield AllowedMedia { diff --git a/patterns/xci.hexpat b/patterns/xci.hexpat index 92d86f2..f806fd6 100644 --- a/patterns/xci.hexpat +++ b/patterns/xci.hexpat @@ -1,10 +1,10 @@ #pragma author WerWolv #pragma description Nintendo Switch XCI cardridge ROM -#include +import std.core; -#include -#include +import type.magic; +import type.size; #define PAGE_SIZE 0x200 diff --git a/patterns/xilinx_bit.hexpat b/patterns/xilinx_bit.hexpat index 6581386..44dab96 100644 --- a/patterns/xilinx_bit.hexpat +++ b/patterns/xilinx_bit.hexpat @@ -1,8 +1,8 @@ #pragma author WerWolv #pragma description Xilinx FPGA Bitstreams -#include -#include +import std.mem; +import std.io; struct Flags { be u16 length; diff --git a/patterns/xilinx_bootgen.hexpat b/patterns/xilinx_bootgen.hexpat index d601f70..3c620eb 100644 --- a/patterns/xilinx_bootgen.hexpat +++ b/patterns/xilinx_bootgen.hexpat @@ -4,11 +4,11 @@ // Spec: Xilinx UG1283 https://docs.xilinx.com/r/en-US/ug1283-bootgen-user-guide/Zynq-UltraScale-MPSoC-Boot-and-Configuration -#include -#include -#include -#include -#include +import type.magic; +import std.io; +import std.mem; +import std.array; +import std.ptr; fn format_u32_string(auto arr) { str result = ""; diff --git a/patterns/zip.hexpat b/patterns/zip.hexpat index d095318..c3c1780 100644 --- a/patterns/zip.hexpat +++ b/patterns/zip.hexpat @@ -2,9 +2,9 @@ #pragma MIME application/zip -#include -#include -#include +import std.mem; +import std.math; +import type.time; struct EndOfCentralDirectory { u32 headerSignature [[comment("EoCD magic"), name("EoCD PK\\5\\6")]]; diff --git a/patterns/zlib.hexpat b/patterns/zlib.hexpat index 9a595f5..09cf96b 100644 --- a/patterns/zlib.hexpat +++ b/patterns/zlib.hexpat @@ -2,8 +2,8 @@ #pragma MIME application/zlib -#include -#include +import std.core; +import std.sys; #define HEADER_SIZE 2 #define CSUM_SIZE 4 diff --git a/patterns/zstd.hexpat b/patterns/zstd.hexpat index f6bbb7c..64faae8 100644 --- a/patterns/zstd.hexpat +++ b/patterns/zstd.hexpat @@ -4,10 +4,10 @@ #pragma MIME application/zstd -#include -#include -#include -#include +import std.core; +import std.io; +import std.mem; +import std.sys; using BitfieldOrder = std::core::BitfieldOrder; diff --git a/scripts/ksy2pat.py b/scripts/ksy2pat.py index 1c7f20f..5ddf6ed 100644 --- a/scripts/ksy2pat.py +++ b/scripts/ksy2pat.py @@ -174,7 +174,7 @@ def handle_seq(seq): def generate_imhex_pattern(data): global top_level_struct - add_line("#include \n") + add_line("import type.magic;\n") if "meta" in data: handle_meta(data["meta"])