OLD | NEW |
1 // Copyright 2013 The Go Authors. All rights reserved. | 1 // Copyright 2013 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // +build windows plan9 | 5 // +build windows |
6 | 6 |
7 package interp | 7 package interp |
8 | 8 |
9 import ( | 9 import ( |
10 "exp/ssa" | 10 "exp/ssa" |
| 11 "syscall" |
11 ) | 12 ) |
12 | 13 |
13 func ext۰syscall۰Kill(fn *ssa.Function, args []value, slots []value) value { | 14 func ext۰syscall۰Kill(fn *ssa.Function, args []value, slots []value) value { |
14 panic("syscall.Kill not yet implemented") | 15 panic("syscall.Kill not yet implemented") |
15 } | 16 } |
16 | 17 |
17 func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value) value { | 18 func ext۰syscall۰Write(fn *ssa.Function, args []value, slots []value) value { |
18 » panic("syscall.Write not yet implemented") | 19 » // We could emulate syscall.Syscall but it's more effort. |
| 20 » p := args[1].([]value) |
| 21 » b := make([]byte, 0, len(p)) |
| 22 » for i := range p { |
| 23 » » b = append(b, p[i].(byte)) |
| 24 » } |
| 25 » n, _ := syscall.Write(args[0].(syscall.Handle), b) |
| 26 » err := iface{} // TODO(adonovan): fix: adapt concrete err to interpreted
iface. |
| 27 » return tuple{n, err} |
19 } | 28 } |
OLD | NEW |