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 8use strict; 9 10if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { 11 print STDERR "GOARCH or GOOS not defined in environment\n"; 12 exit 1; 13} 14 15my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); 16 17print <<EOF; 18// $command 19// Code generated by the command above; see README.md. DO NOT EDIT. 20 21// +build $ENV{'GOARCH'},$ENV{'GOOS'} 22 23package unix 24 25const ( 26EOF 27 28while(<>){ 29 if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ 30 my $name = $1; 31 my $num = $2; 32 $name =~ y/a-z/A-Z/; 33 print " SYS_$name = $num;" 34 } 35} 36 37print <<EOF; 38) 39EOF 40