-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathExtern.scala
36 lines (29 loc) · 1.08 KB
/
Extern.scala
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
package org.scalanative.bindgen.samples
import scala.scalanative._
import scala.scalanative.native._
@native.link("bindgentests")
@native.extern
object Extern {
type enum_mode = native.CUnsignedInt
object enum_mode {
final val SYSTEM: enum_mode = 0.toUInt
final val USER: enum_mode = 1.toUInt
}
type struct_version = native.CStruct3[native.CInt, native.CInt, native.CInt]
val forty_two: native.CInt = native.extern
val version: native.CString = native.extern
val mode: enum_mode = native.extern
val semver: native.Ptr[struct_version] = native.extern
}
import Extern._
object ExternHelpers {
implicit class struct_version_ops(val p: native.Ptr[struct_version]) extends AnyVal {
def major: native.CInt = !p._1
def major_=(value: native.CInt): Unit = !p._1 = value
def minor: native.CInt = !p._2
def minor_=(value: native.CInt): Unit = !p._2 = value
def patch: native.CInt = !p._3
def patch_=(value: native.CInt): Unit = !p._3 = value
}
def struct_version()(implicit z: native.Zone): native.Ptr[struct_version] = native.alloc[struct_version]
}