pit_basic/buffer/
ffi.rs

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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
pub trait R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5 {
    fn read8(&mut self, p0: u32) -> (u32);
    fn size(&mut self) -> (u32);
    fn write8(&mut self, p0: u32, p1: u32) -> ();
}
const _: () = {
    #[link_section = ".pit-types"]
    static SECTION_CONTENT: [u8; 60usize] = [
        123u8,
        114u8,
        101u8,
        97u8,
        100u8,
        56u8,
        40u8,
        73u8,
        51u8,
        50u8,
        41u8,
        32u8,
        45u8,
        62u8,
        32u8,
        40u8,
        73u8,
        51u8,
        50u8,
        41u8,
        59u8,
        115u8,
        105u8,
        122u8,
        101u8,
        40u8,
        41u8,
        32u8,
        45u8,
        62u8,
        32u8,
        40u8,
        73u8,
        51u8,
        50u8,
        41u8,
        59u8,
        119u8,
        114u8,
        105u8,
        116u8,
        101u8,
        56u8,
        40u8,
        73u8,
        51u8,
        50u8,
        44u8,
        73u8,
        51u8,
        50u8,
        41u8,
        32u8,
        45u8,
        62u8,
        32u8,
        40u8,
        41u8,
        125u8,
        0u8,
    ];
    fn alloc<T>(m: &mut ::std::collections::BTreeMap<u32, T>, x: T) -> u32 {
        let mut u = 0;
        while m.contains_key(&u) {
            u += 1;
        }
        m.insert(u, x);
        return u;
    }
    #[derive(Default)]
    struct TableCell {
        all: std::cell::UnsafeCell<
            ::std::collections::BTreeMap<
                u32,
                Box<
                    dyn R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5,
                >,
            >,
        >,
    }
    unsafe impl Send for TableCell {}
    unsafe impl Sync for TableCell {}
    static TABLE: ::std::sync::LazyLock<TableCell> = ::std::sync::LazyLock::new(|| TableCell::default());
    impl R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5
    for ::tpit_rt::Tpit<
        Box<dyn R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5>,
    > {
        fn read8(&mut self, p0: u32) -> (u32) {
            #[link(
                wasm_import_module = "tpit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5"
            )]
            extern "C" {
                #[link_name = "read8"]
                fn go(this: u32, p0: u32) -> (u32);
            }
            return unsafe { go(self.ptr(), p0) };
        }
        fn size(&mut self) -> (u32) {
            #[link(
                wasm_import_module = "tpit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5"
            )]
            extern "C" {
                #[link_name = "size"]
                fn go(this: u32) -> (u32);
            }
            return unsafe { go(self.ptr()) };
        }
        fn write8(&mut self, p0: u32, p1: u32) -> () {
            #[link(
                wasm_import_module = "tpit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5"
            )]
            extern "C" {
                #[link_name = "write8"]
                fn go(this: u32, p0: u32, p1: u32) -> ();
            }
            return unsafe { go(self.ptr(), p0, p1) };
        }
    }
    #[export_name = "tpit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5/~8afbd04c549e07db517e034114e4b8ff8c76ce748f2e2d6e29fcaf48051eaf3e.drop"]
    extern "C" fn _drop(a: u32) {
        unsafe { (&mut *(TABLE.all.get())).remove(&a) };
    }
    #[export_name = "tpit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5/~8afbd04c549e07db517e034114e4b8ff8c76ce748f2e2d6e29fcaf48051eaf3e/read8"]
    extern "C" fn read8(id: u32, p0: u32) -> (u32) {
        return unsafe { &mut *(TABLE.all.get()) }.get_mut(&id).unwrap().read8(p0);
    }
    #[export_name = "tpit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5/~8afbd04c549e07db517e034114e4b8ff8c76ce748f2e2d6e29fcaf48051eaf3e/size"]
    extern "C" fn size(id: u32) -> (u32) {
        return unsafe { &mut *(TABLE.all.get()) }.get_mut(&id).unwrap().size();
    }
    #[export_name = "tpit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5/~8afbd04c549e07db517e034114e4b8ff8c76ce748f2e2d6e29fcaf48051eaf3e/write8"]
    extern "C" fn write8(id: u32, p0: u32, p1: u32) -> () {
        return unsafe { &mut *(TABLE.all.get()) }.get_mut(&id).unwrap().write8(p0, p1);
    }
    impl From<Box<dyn R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5>>
    for ::tpit_rt::Tpit<
        Box<dyn R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5>,
    > {
        fn from(
            a: Box<dyn R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5>,
        ) -> Self {
            #[link(
                wasm_import_module = "pit/867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5"
            )]
            extern "C" {
                #[link_name = "~8afbd04c549e07db517e034114e4b8ff8c76ce748f2e2d6e29fcaf48051eaf3e"]
                fn _push(
                    a: u32,
                ) -> ::tpit_rt::Tpit<
                    Box<
                        dyn R867207405fe87fda620c2d7a5485e8e5e274636a898a166fb674448b4391ffc5,
                    >,
                >;
            }
            return unsafe { _push(alloc(&mut *(TABLE.all.get()), a)) };
        }
    }
};