1
0
mirror of https://github.com/golang/go synced 2024-10-04 04:31:21 -06:00
go/src/pkg/runtime/mkgodefs.sh
2011-01-31 12:27:28 +01:00

40 lines
639 B
Bash
Executable File

#!/bin/sh
# Copyright 2011 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
set -e
cat <<EOF
// Go definitions for C variables and types.
// AUTOMATICALLY GENERATED BY THE FOLLOWING COMMAND. DO NOT EDIT.
// CC="$CC" CFLAGS="$CFLAGS" ./mkgodefs.sh $@
package runtime
import "unsafe"
var _ unsafe.Pointer
EOF
for i in "$@"; do
$CC $CFLAGS -q $i
done | awk '
/^func/ { next }
/^const/ { next }
/^\/\/.*type/ { next }
/^(const|func|type|var) / {
if(seen[$2]++) {
skip = /{[^}]*$/;
next;
}
}
skip {
skip = !/^}/
next;
}
{print}
'