You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
751 B

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