@@ -7,17 +7,29 @@ import scala.scalanative.native._
77@ native.extern
88object Struct {
99 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
1013 type point_s = native.Ptr [struct_point]
1114 type struct_bigStruct = native.CArray [Byte , native.Nat .Digit [native.Nat ._1, native.Nat .Digit [native.Nat ._1, native.Nat ._2]]]
1215 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
1419 def getBigStructSize (): native.CInt = native.extern
1520 def getCharFromAnonymousStruct (s : native.Ptr [struct_structWithAnonymousStruct]): native.CChar = native.extern
1621 def getIntFromAnonymousStruct (s : native.Ptr [struct_structWithAnonymousStruct]): native.CChar = native.extern
1722}
1823
1924import Struct ._
2025
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+
2133object StructHelpers {
2234
2335 implicit class struct_point_ops (val p : native.Ptr [struct_point]) extends AnyVal {
@@ -29,6 +41,15 @@ object StructHelpers {
2941
3042 def struct_point ()(implicit z : native.Zone ): native.Ptr [struct_point] = native.alloc[struct_point]
3143
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+
3253 implicit class struct_structWithAnonymousStruct_ops (val p : native.Ptr [struct_structWithAnonymousStruct]) extends AnyVal {
3354 def a : native.CInt = ! p._1
3455 def a_= (value : native.CInt ): Unit = ! p._1 = value
0 commit comments