]> Cypherpunks repositories - gostls13.git/commitdiff
delete one cgo playpen
authorRuss Cox <rsc@golang.org>
Thu, 15 Oct 2009 01:08:10 +0000 (18:08 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 15 Oct 2009 01:08:10 +0000 (18:08 -0700)
R=r
DELTA=111  (0 added, 111 deleted, 0 changed)
OCL=35739
CL=35744

usr/rsc/fib/6c.c [deleted file]
usr/rsc/fib/Makefile [deleted file]
usr/rsc/fib/gcc.c [deleted file]
usr/rsc/fib/go.go [deleted file]
usr/rsc/fib/main.go [deleted file]

diff --git a/usr/rsc/fib/6c.c b/usr/rsc/fib/6c.c
deleted file mode 100644 (file)
index 23ed846..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2009 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.
-
-#include "runtime.h"
-#include "cgocall.h"
-
-// turn on ffi
-#pragma dynld initcgo initcgo "libcgo.so"
-#pragma dynld cgo cgo "libcgo.so"
-
-// pull in fib from fib.so
-#pragma dynld extern_c_fib fib "fib.so"
-void (*extern_c_fib)(void*);
-
-void
-fibĀ·Fib(int32 n, int32, int32)
-{
-       cgocall(extern_c_fib, &n);
-}
diff --git a/usr/rsc/fib/Makefile b/usr/rsc/fib/Makefile
deleted file mode 100644 (file)
index 0597633..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2009 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.
-
-# FFI demo
-
-all: fib.a fib.so
-
-gcc.o: gcc.c
-       gcc -fPIC -O2 -o gcc.o -c gcc.c
-
-fib.so: gcc.o
-       gcc -shared -o fib.so gcc.o -L$(GOROOT)/pkg/$(GOOS)_$(GOARCH) -lcgo
-
-fib.a: 6c.6 go.6
-       gopack grc fib.a 6c.6 go.6
-
-6c.6: 6c.c
-       6c -FVw -I$(GOROOT)/src/pkg/runtime 6c.c
-
-go.6: go.go
-       6g go.go
-
-PKG=$(GOROOT)/pkg/$(GOOS)_$(GOARCH)
-
-install: $(PKG)/fib.so $(PKG)/fib.a
-
-$(PKG)/fib.so: fib.so
-       cp fib.so $@
-
-$(PKG)/fib.a: fib.a
-       cp fib.a $@
-
-clean:
-       rm -f *.6 *.o *.so *.a
-
diff --git a/usr/rsc/fib/gcc.c b/usr/rsc/fib/gcc.c
deleted file mode 100644 (file)
index a898390..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2009 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.
-
-#include <stdint.h>
-
-typedef int32_t int32;
-
-static int32
-fib1(int32 n)
-{
-       int32 a, b, t;
-
-       a = 0;
-       b = 1;
-       for(; n>0; n--) {
-               t = a;
-               a = b;
-               b += t;
-       }
-       return a;
-}
-
-void
-fib(void *v)
-{
-       struct {        // 6g func(n int) int
-               int32 n;
-               int32 pad;
-               int32 ret;
-       } *args = v;
-
-       args->ret = fib1(args->n);
-}
diff --git a/usr/rsc/fib/go.go b/usr/rsc/fib/go.go
deleted file mode 100644 (file)
index 8145974..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-// Copyright 2009 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.
-
-package fib
-
-func Fib(n int) int
-
diff --git a/usr/rsc/fib/main.go b/usr/rsc/fib/main.go
deleted file mode 100644 (file)
index 3ac5d59..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2009 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.
-
-package main
-
-import "fib"
-
-func main() {
-       for i := 0; i < 10; i++ {
-               println(fib.Fib(i));
-       }
-}