summaryrefslogtreecommitdiff
path: root/lang/sr/patches/patch-be
blob: 9d22f8e7281c5829cad5c1161102c63fd448eb6a (plain)
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
$NetBSD: patch-be,v 1.1 2005/03/09 20:38:26 is Exp $

--- /dev/null	2005-03-09 09:35:53.000000000 +0100
+++ vsuite/quick/ptrstr/pointer.sr
@@ -0,0 +1,29 @@
+resource hello()
+  type pt = ptr int
+  type pa = ptr [1:2]int
+  var foo: pa
+  var bar: pa
+  var baz: pa
+  var nul: pa
+  var foos: string[20]
+  var bars: string[20]
+  var anint: int
+  
+  write("Testing pointer-string-pointer conversions:")
+
+  nul := null
+  write("Null pointer:", nul, "; string:", string(nul),
+	"; int:", int(nul), "; pt(==null==):", pt("==null=="))
+
+  baz := new([1:2]int)
+
+  foo := new([1:2]int)
+  foos:= string(foo)
+
+  bar := pa(foos||"x")
+  bars:= string(bar)
+
+  write("pointer identity:", foo = bar)
+  write("string  identity:", foos = bars)
+
+end