| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Common.Utils.Bytecode.Header
Synopsis
- extractContentIfValidHeader :: ByteString -> IO ByteString
- evaluateHeader :: ByteString -> Bool
- hasValidSize :: ByteString -> Bool
- hasValidMagic :: ByteString -> Bool
- hasValidVersion :: ByteString -> Bool
Documentation
extractContentIfValidHeader :: ByteString -> IO ByteString Source #
Validates the .gla file header and returns the raw bytecode.
@details If the header is valid, drops the 10-byte header and returns the code. If invalid, prints a generic error and exits.
evaluateHeader :: ByteString -> Bool Source #
Evaluates the header validity by combining all predicates.
@details
Uses short-circuit boolean logic (&&).
Order matters: hasValidSize must be checked first to prevent
segmentation faults in hasValidVersion.
hasValidSize :: ByteString -> Bool Source #
Checks if the file is large enough to contain a header (10 bytes).
hasValidMagic :: ByteString -> Bool Source #
Checks if the Magic Number is GLAD (0x47 0x4C 0x41 0x44).
hasValidVersion :: ByteString -> Bool Source #
Checks if the Version is supported (0x02).