LEFT | RIGHT |
1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
2 # Copyright 2009 The Go Authors. All rights reserved. | 2 # Copyright 2009 The Go Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style | 3 # Use of this source code is governed by a BSD-style |
4 # license that can be found in the LICENSE file. | 4 # license that can be found in the LICENSE file. |
5 # | 5 # |
6 # Generate system call table for Darwin from sys/syscall.h | 6 # Generate system call table for Darwin from sys/syscall.h |
7 | 7 |
8 use strict; | 8 use strict; |
9 use warnings; | |
10 | 9 |
11 my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); | 10 my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); |
12 | 11 |
13 print <<EOF; | 12 print <<EOF; |
14 // $command | 13 // $command |
15 // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT | 14 // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT |
16 | 15 |
17 package syscall | 16 package syscall |
18 | 17 |
19 const ( | 18 const ( |
20 EOF | 19 EOF |
21 | 20 |
22 while(<>){ | 21 while(<>){ |
23 if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ | 22 if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ |
24 my $name = $1; | 23 my $name = $1; |
25 my $num = $2; | 24 my $num = $2; |
26 $name =~ y/a-z/A-Z/; | 25 $name =~ y/a-z/A-Z/; |
27 print " SYS_$name = $num;" | 26 print " SYS_$name = $num;" |
28 } | 27 } |
29 } | 28 } |
30 | 29 |
31 print <<EOF; | 30 print <<EOF; |
32 ) | 31 ) |
33 EOF | 32 EOF |
LEFT | RIGHT |