chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 16 May 2019 11:51:10 +0000 (12:51 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 16 May 2019 11:51:10 +0000 (12:51 +0100)
ffi-example-cpp.txt
ffi-example.txt
tour-main.fig

index fa78ed1f2b93c4e9a38c8668e3b8f1979cf92b52..953237605a0cd8a0941731812f8d3c5d876d1903 100644 (file)
@@ -1,5 +1,5 @@
 extern "C" {
-   int cxx_chrobak_payne(const size_t nvertices,
-                        const size_t edge_data[][2],
-                        const size_t n_edge_data,
-                         ...
+  int cxx_chrobak_payne(const size_t nvertices,
+                        const size_t edge_data[][2],
+                        const size_t n_edge_data,
+                        ...
index 9632421dff8f8bc4417d07f35aeb7442d0c63183..9f89a0ae4c0ec4fa36630a960803720b8daf48c1 100644 (file)
@@ -1,13 +1,14 @@
 #[link(name="glue")]
 extern "C" {
-    pub fn cxx_chrobak_payne(
-        nvertices : size_t,
-        edge_data : *const [size_t; 2],
-        n_edge_data : size_t,
+  pub fn cxx_chrobak_payne(
+    nvertices : size_t,
+    edge_data : *const [size_t; 2],
+    n_edge_data : size_t,
 ...
 }
 
-    let ok = unsafe {
-       cxx_chrobak_payne(nvertices,
-                        edges.as_ptr(), edges.len(),
-                        ...
+  let ok = unsafe {
+    cxx_chrobak_payne(nvertices,
+                      edges.as_ptr(),
+                      edges.len(),
+                      ...
index 7279814c85f5363d00c6eea1157e951f76499d2a..43b0e0eb3ce189f0a0794022492bad87d2100556 100644 (file)
@@ -43,14 +43,24 @@ Single
         -1530 1710 9900 1710 9900 5904 -1530 5904 -1530 1710
 2 5 0 1 0 -1 172 -1 20 0.000 0 0 -1 0 0 5
        0 ffi-example.txt.eps
-        -1440 -450 6930 -450 6930 4112 -1440 4112 -1440 -450
-2 5 0 1 0 -1 172 -1 20 0.000 0 0 -1 0 0 5
-       0 ffi-example-cpp.txt.eps
-        -1440 4590 7425 4590 7425 6030 -1440 6030 -1440 4590
+        -1440 -1170 6212 -1170 6212 3592 -1440 3592 -1440 -1170
 2 2 0 1 0 7 272 -1 20 0.000 0 0 -1 0 0 5
-        -1440 -450 7020 -450 7020 4230 -1440 4230 -1440 -450
+        -1530 -1260 7020 -1260 7020 3870 -1530 3870 -1530 -1260
 2 2 0 1 0 7 272 -1 20 0.000 0 0 -1 0 0 5
-        -1530 4500 7560 4500 7560 6120 -1530 6120 -1530 4500
+        -1530 4140 9540 4140 9540 6120 -1530 6120 -1530 4140
+2 5 0 1 0 -1 172 -1 20 0.000 0 0 -1 0 0 5
+       0 ffi-example-cpp.txt.eps
+        -1440 4320 9356 4320 9356 5940 -1440 5940 -1440 4320
+2 1 0 2 1 7 72 -1 -1 0.000 0 0 -1 0 0 2
+        2070 450 2250 1080
+2 1 0 2 1 7 72 -1 -1 0.000 0 0 -1 0 0 2
+        2250 2070 2880 1980
+2 1 0 2 1 7 72 -1 -1 0.000 0 0 -1 0 0 3
+        3150 2610 2970 2880 3150 2880
+2 1 0 2 1 7 72 -1 -1 0.000 0 0 -1 0 0 2
+        2970 2880 3150 3150
+2 2 0 2 1 7 72 -1 -1 0.000 0 0 -1 0 0 5
+        7470 -1260 9720 -1260 9720 540 7470 540 7470 -1260
 4 0 0 50 -1 2 32 0.0000 4 465 11850 -1530 -1620 Other properties of Rust - illustrated in an example\001
 4 0 1 62 -1 1 27 0.0000 4 405 6480 1980 4320 by specifying values of the members\001
 4 0 1 63 -1 1 27 0.0000 4 405 4680 4230 1710 struct type is polymorphic\001
@@ -80,3 +90,10 @@ Single
 4 0 0 380 -1 2 30 0.0000 4 330 795 7650 -720 FFI\001
 4 0 0 380 -1 2 27 0.0000 4 390 1350 7830 -180 talking\001
 4 0 0 380 -1 2 27 0.0000 4 300 1605 7830 270 to C etc.\001
+4 0 0 72 -1 2 32 0.0000 4 360 1080 -1440 3690 Rust\001
+4 0 0 72 -1 2 32 0.0000 4 360 1020 -1440 6030 C++\001
+4 0 1 72 -1 1 27 0.0000 4 390 2970 1170 1440 raw pointer type\001
+4 0 1 72 -1 1 27 0.0000 4 405 2955 4230 810 array of 2 size_t\001
+4 0 1 72 -1 1 27 0.0000 4 405 5160 2970 2070 calls out of Rust are not safe\001
+4 0 1 72 -1 1 27 0.0000 4 405 2235 810 3060 types will be\001
+4 0 1 72 -1 1 27 0.0000 4 315 1425 1620 3420 checked\001