summaryrefslogtreecommitdiff
path: root/spec/iex/iex-spec.txt
blob: 6979cfc964cc091a77d189fa44518129102f9e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
This is the IEX file specification.

Document version (semver): 0.0.1
Main Author: Kyle Gunger

License: Apache 2.0

----------------------------------

Contents:

Organization

----------------------------------

Organization

Magic number starts the file "IEX" or 0x49 0x45 0x58

The header of the file can be represented as such

;struct IEX_HEAD {
    raw {3}char     # Always "IEX"
        magic,
        
    {}char
        name,
        arch,
        os,
    
    uint8           # Version info
        major,
        minor,
        patch,
                    # OS abi info
        os_major,
        os_minor,
        os_patch,
    
    bool            # Tells loader that the file holds a main function
        can_execute,

    ~void ({}{}char args) [int]
                    # Address of main in file
        start_addr,

    {}IEX_SECTION
        sections,

    {}IEX_LIB
        dependencies,
    
    IEX_MODULE
        self
}

a section is defined as

;struct IEX_SECTION {
    {}char
        name,
    
    uint8       # Denotes dependency, symbol table, data, bss, text, etc.
        type,

    ~void       # Points to start and end of section
        start,
        end
}

;struct IEX_LIB {
    {}char
        name,
    
    uint8       # Version info
        major,
        minor,
        patch
}

;struct IEX_MODULE {
    {}char
        name,
    
    {}IEX_FUNCTION
        func,
    
    {}IEX_TYPE
        types,

    {}IEX_MODULE
        sub
}

;struct IEX_FUNCTION {
    {}char
        name,
    
    uint32
        overload,
        bytes_in,
        bytes_out,
    
    ~void
        addr
}

;struct IEX_TYPE {
    {}char
        name,
    
    bool
        raw_struct,
        interface,
        dynamic,

    uint32
        size,
    
    {}IEX_FUNCTION
        methods,
    
    {}IEX_TYPE
        supers,

    ~void
        addr
}