github.com/tcnksm/go@v0.0.0-20141208075154-439b32936367/src/syscall/mksysnum_darwin.pl (about)

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