47 lines
1.3 KiB
Plaintext
47 lines
1.3 KiB
Plaintext
native :: import "../include/native.h"
|
|
|
|
Manual :: c_struct {
|
|
value c_int
|
|
}
|
|
|
|
mirror_manual c_func(value Manual) Manual {
|
|
return value
|
|
}
|
|
|
|
mirror_large c_func(value native.Large) native.Large {
|
|
return value
|
|
}
|
|
|
|
native_pair func(value native.Pair) native.Pair {
|
|
return value
|
|
}
|
|
|
|
global_pair native.Pair :: native.Pair { left = 1, right = 2 }
|
|
|
|
main func() i32 {
|
|
pair native.Pair = native_pair(global_pair)
|
|
pair.left = 10
|
|
pair = native.echo_pair(pair)
|
|
pairs [1]native.Pair :: [pair]
|
|
_ = native_pair(pairs[0])
|
|
|
|
triple native.Triple :: native.echo_triple(native.Triple { first = 3, second = 4, third = 5 })
|
|
floats native.Floats :: native.echo_floats(native.Floats { x = 6.0, y = 7.0 })
|
|
large native.Large :: mirror_large(native.echo_large(native.Large { values = [8, 9, 10] }))
|
|
nested native.Nested :: native.echo_nested(native.Nested {
|
|
pair = native.Pair { left = 11, right = 12 },
|
|
tail = 13,
|
|
})
|
|
arrays native.Arrays :: native.echo_arrays(native.Arrays { values = [14, 15, 16] })
|
|
choice native.Choice = native.Choice { decimal = 1.0 }
|
|
choice.integer = 17
|
|
choice = native.echo_choice(choice)
|
|
forward native.Forward :: native.echo_forward(native.Forward { value = 19 })
|
|
manual Manual :: mirror_manual(Manual { value = 18 })
|
|
_ = manual.value
|
|
_ = forward.value
|
|
|
|
_ = native.verify_records(pair, triple, floats, large, nested, arrays, choice)
|
|
return 1
|
|
}
|