@@ -7,17 +7,29 @@ import scala.scalanative.native._
7
7
@ native.extern
8
8
object Struct {
9
9
type struct_point = native.CStruct2 [native.CInt , native.CInt ]
10
+ type point = struct_point
11
+ type struct_points = native.CStruct2 [struct_point, point]
12
+ type enum_pointIndex = native.CUnsignedInt
10
13
type point_s = native.Ptr [struct_point]
11
14
type struct_bigStruct = native.CArray [Byte , native.Nat .Digit [native.Nat ._1, native.Nat .Digit [native.Nat ._1, native.Nat ._2]]]
12
15
type struct_structWithAnonymousStruct = native.CStruct2 [native.CInt , native.CArray [Byte , native.Nat ._8]]
13
- def getPoint (): native.Ptr [struct_point] = native.extern
16
+ def setPoints (points : native.Ptr [struct_points], x1 : native.CInt , y1 : native.CInt , x2 : native.CInt , y2 : native.CInt ): Unit = native.extern
17
+ def getPoint (points : native.Ptr [struct_points], pointIndex : enum_pointIndex): native.CInt = native.extern
18
+ def createPoint (): native.Ptr [struct_point] = native.extern
14
19
def getBigStructSize (): native.CInt = native.extern
15
20
def getCharFromAnonymousStruct (s : native.Ptr [struct_structWithAnonymousStruct]): native.CChar = native.extern
16
21
def getIntFromAnonymousStruct (s : native.Ptr [struct_structWithAnonymousStruct]): native.CChar = native.extern
17
22
}
18
23
19
24
import Struct ._
20
25
26
+ object StructEnums {
27
+ final val enum_pointIndex_X1 : enum_pointIndex = 0 .toUInt
28
+ final val enum_pointIndex_Y1 : enum_pointIndex = 1 .toUInt
29
+ final val enum_pointIndex_X2 : enum_pointIndex = 2 .toUInt
30
+ final val enum_pointIndex_Y2 : enum_pointIndex = 3 .toUInt
31
+ }
32
+
21
33
object StructHelpers {
22
34
23
35
implicit class struct_point_ops (val p : native.Ptr [struct_point]) extends AnyVal {
@@ -29,6 +41,15 @@ object StructHelpers {
29
41
30
42
def struct_point ()(implicit z : native.Zone ): native.Ptr [struct_point] = native.alloc[struct_point]
31
43
44
+ implicit class struct_points_ops (val p : native.Ptr [struct_points]) extends AnyVal {
45
+ def p1 : native.Ptr [struct_point] = p._1
46
+ def p1_= (value : native.Ptr [struct_point]): Unit = ! p._1 = ! value
47
+ def p2 : native.Ptr [point] = p._2
48
+ def p2_= (value : native.Ptr [point]): Unit = ! p._2 = ! value
49
+ }
50
+
51
+ def struct_points ()(implicit z : native.Zone ): native.Ptr [struct_points] = native.alloc[struct_points]
52
+
32
53
implicit class struct_structWithAnonymousStruct_ops (val p : native.Ptr [struct_structWithAnonymousStruct]) extends AnyVal {
33
54
def a : native.CInt = ! p._1
34
55
def a_= (value : native.CInt ): Unit = ! p._1 = value
0 commit comments