Phasor 3.1.1
Stack VM based Programming Language
Loading...
Searching...
No Matches
Metadata.py
Go to the documentation of this file.
1"""
2phasor.Metadata
3================
4Binary format constants shared by the Serializer and Deserializer.
5"""
6
7def _ascii_to_u32_le(s: str) -> int:
8 """Pack a 4-character ASCII string into a little-endian uint32 magic number."""
9 b = s.encode("ascii")
10 return b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)
11
12MAGIC: int = _ascii_to_u32_le("PHSB")
13VERSION: int = 0x03000000
14HEADER_SIZE: int = 16 # bytes: MAGIC(4) + VERSION(4) + FLAGS(4) + CHECKSUM(4)
15
16SEC_CONSTANTS: int = 0x01
17SEC_VARIABLES: int = 0x02
18SEC_INSTRUCTIONS: int = 0x03
19SEC_FUNCTIONS: int = 0x04
int _ascii_to_u32_le(str s)
Definition Metadata.py:7