mirror of
https://github.com/golang/go
synced 2024-11-21 19:54:41 -07:00
syscall: use strict in perl scripts
R=golang-dev, bradfitz, rsc CC=golang-dev https://golang.org/cl/4609047
This commit is contained in:
parent
0193139bec
commit
7fd51f2fb4
@ -19,11 +19,13 @@
|
|||||||
# block, as otherwise the system call could cause all goroutines to
|
# block, as otherwise the system call could cause all goroutines to
|
||||||
# hang.
|
# hang.
|
||||||
|
|
||||||
$cmdline = "mksyscall.pl " . join(' ', @ARGV);
|
use strict;
|
||||||
$errors = 0;
|
|
||||||
$_32bit = "";
|
my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
|
||||||
$nacl = 0;
|
my $errors = 0;
|
||||||
$plan9 = 0;
|
my $_32bit = "";
|
||||||
|
my $nacl = 0;
|
||||||
|
my $plan9 = 0;
|
||||||
|
|
||||||
if($ARGV[0] eq "-b32") {
|
if($ARGV[0] eq "-b32") {
|
||||||
$_32bit = "big-endian";
|
$_32bit = "big-endian";
|
||||||
@ -66,7 +68,7 @@ sub parseparam($) {
|
|||||||
return ($1, $2);
|
return ($1, $2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = "";
|
my $text = "";
|
||||||
while(<>) {
|
while(<>) {
|
||||||
chomp;
|
chomp;
|
||||||
s/\s+/ /g;
|
s/\s+/ /g;
|
||||||
|
@ -23,9 +23,11 @@
|
|||||||
# //sys LoadLibrary(libname string) (handle uint32, errno int) [failretval==-1] = LoadLibraryA
|
# //sys LoadLibrary(libname string) (handle uint32, errno int) [failretval==-1] = LoadLibraryA
|
||||||
# and is [failretval==0] by default.
|
# and is [failretval==0] by default.
|
||||||
|
|
||||||
$cmdline = "mksyscall_windows.pl " . join(' ', @ARGV);
|
use strict;
|
||||||
$errors = 0;
|
|
||||||
$_32bit = "";
|
my $cmdline = "mksyscall_windows.pl " . join(' ', @ARGV);
|
||||||
|
my $errors = 0;
|
||||||
|
my $_32bit = "";
|
||||||
|
|
||||||
binmode STDOUT;
|
binmode STDOUT;
|
||||||
|
|
||||||
@ -62,10 +64,10 @@ sub parseparam($) {
|
|||||||
return ($1, $2);
|
return ($1, $2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = "";
|
my $text = "";
|
||||||
$vars = "";
|
my $vars = "";
|
||||||
$mods = "";
|
my $mods = "";
|
||||||
$modnames = "";
|
my $modnames = "";
|
||||||
while(<>) {
|
while(<>) {
|
||||||
chomp;
|
chomp;
|
||||||
s/\s+/ /g;
|
s/\s+/ /g;
|
||||||
@ -91,7 +93,7 @@ while(<>) {
|
|||||||
if($modname eq "") {
|
if($modname eq "") {
|
||||||
$modname = "kernel32";
|
$modname = "kernel32";
|
||||||
}
|
}
|
||||||
$modvname = "mod$modname";
|
my $modvname = "mod$modname";
|
||||||
if($modnames !~ /$modname/) {
|
if($modnames !~ /$modname/) {
|
||||||
$modnames .= ".$modname";
|
$modnames .= ".$modname";
|
||||||
$mods .= "\t$modvname = loadDll(\"$modname.dll\")\n";
|
$mods .= "\t$modvname = loadDll(\"$modname.dll\")\n";
|
||||||
@ -103,7 +105,7 @@ while(<>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# System call pointer variable name.
|
# System call pointer variable name.
|
||||||
$sysvarname = "proc$sysname";
|
my $sysvarname = "proc$sysname";
|
||||||
|
|
||||||
# Returned value when failed
|
# Returned value when failed
|
||||||
if($failcond eq "") {
|
if($failcond eq "") {
|
||||||
@ -111,17 +113,13 @@ while(<>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Decide which version of api is used: ascii or unicode.
|
# Decide which version of api is used: ascii or unicode.
|
||||||
if($sysname !~ /W$/) {
|
my $strconvfunc = $sysname !~ /W$/ ? "StringBytePtr" : "StringToUTF16Ptr";
|
||||||
$strconvfunc = "StringBytePtr";
|
|
||||||
} else {
|
|
||||||
$strconvfunc = "StringToUTF16Ptr";
|
|
||||||
}
|
|
||||||
|
|
||||||
# Winapi proc address variable.
|
# Winapi proc address variable.
|
||||||
$vars .= sprintf "\t%s = getSysProcAddr(%s, \"%s\")\n", $sysvarname, $modvname, $sysname;
|
$vars .= sprintf "\t%s = getSysProcAddr(%s, \"%s\")\n", $sysvarname, $modvname, $sysname;
|
||||||
|
|
||||||
# Go function header.
|
# Go function header.
|
||||||
my $out = join(', ', @out);
|
$out = join(', ', @out);
|
||||||
if($out ne "") {
|
if($out ne "") {
|
||||||
$out = " ($out)";
|
$out = " ($out)";
|
||||||
}
|
}
|
||||||
@ -242,7 +240,7 @@ while(<>) {
|
|||||||
$failexpr = "$name $failcond";
|
$failexpr = "$name $failcond";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$failexpr =~ s/(=)([0-9A-Za-z\-+])/\1 \2/; # gofmt compatible
|
$failexpr =~ s/(=)([0-9A-Za-z\-+])/$1 $2/; # gofmt compatible
|
||||||
if($name eq "errno") {
|
if($name eq "errno") {
|
||||||
# Set errno to "last error" only if returned value indicate failure
|
# Set errno to "last error" only if returned value indicate failure
|
||||||
$body .= "\tif $failexpr {\n";
|
$body .= "\tif $failexpr {\n";
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#
|
#
|
||||||
# Generate system call table for Darwin from sys/syscall.h
|
# Generate system call table for Darwin from sys/syscall.h
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
|
my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
|
||||||
|
|
||||||
print <<EOF;
|
print <<EOF;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
# Generate system call table for FreeBSD from master list
|
# Generate system call table for FreeBSD from master list
|
||||||
# (for example, /usr/src/sys/kern/syscalls.master).
|
# (for example, /usr/src/sys/kern/syscalls.master).
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
|
my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
|
||||||
|
|
||||||
print <<EOF;
|
print <<EOF;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
# Use of this source code is governed by a BSD-style
|
# Use of this source code is governed by a BSD-style
|
||||||
# license that can be found in the LICENSE file.
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
my $command = "mksysnum_linux.pl ". join(' ', @ARGV);
|
my $command = "mksysnum_linux.pl ". join(' ', @ARGV);
|
||||||
|
|
||||||
print <<EOF;
|
print <<EOF;
|
||||||
|
Loading…
Reference in New Issue
Block a user