mksysnum_darwin.pl 577 B

1234567891011121314151617181920212223242526272829303132
  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. my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
  9. print <<EOF;
  10. // $command
  11. // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
  12. package unix
  13. const (
  14. EOF
  15. while(<>){
  16. if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
  17. my $name = $1;
  18. my $num = $2;
  19. $name =~ y/a-z/A-Z/;
  20. print " SYS_$name = $num;"
  21. }
  22. }
  23. print <<EOF;
  24. )
  25. EOF