summaryrefslogtreecommitdiff
path: root/misc/swig/callback
diff options
context:
space:
mode:
Diffstat (limited to 'misc/swig/callback')
-rw-r--r--misc/swig/callback/Makefile17
-rw-r--r--misc/swig/callback/callback.h24
-rw-r--r--misc/swig/callback/callback.swigcxx18
-rwxr-xr-xmisc/swig/callback/runbin1179384 -> 0 bytes
-rw-r--r--misc/swig/callback/run.go39
5 files changed, 0 insertions, 98 deletions
diff --git a/misc/swig/callback/Makefile b/misc/swig/callback/Makefile
deleted file mode 100644
index fde0d107b..000000000
--- a/misc/swig/callback/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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.
-
-include ../../../src/Make.inc
-
-TARG=swig/callback
-SWIGFILES=\
- callback.swigcxx
-
-CLEANFILES+=run
-
-include ../../../src/Make.pkg
-
-%: install %.go
- $(GC) $*.go
- $(LD) $(SWIG_RPATH) -o $@ $*.$O
diff --git a/misc/swig/callback/callback.h b/misc/swig/callback/callback.h
deleted file mode 100644
index 80232a8b3..000000000
--- a/misc/swig/callback/callback.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.
-
-class Callback {
-public:
- virtual ~Callback() { }
- virtual std::string run() { return "Callback::run"; }
-};
-
-class Caller {
-private:
- Callback *callback_;
-public:
- Caller(): callback_(0) { }
- ~Caller() { delCallback(); }
- void delCallback() { delete callback_; callback_ = 0; }
- void setCallback(Callback *cb) { delCallback(); callback_ = cb; }
- std::string call() {
- if (callback_ != 0)
- return callback_->run();
- return "";
- }
-};
diff --git a/misc/swig/callback/callback.swigcxx b/misc/swig/callback/callback.swigcxx
deleted file mode 100644
index 0c97ef101..000000000
--- a/misc/swig/callback/callback.swigcxx
+++ /dev/null
@@ -1,18 +0,0 @@
-/* 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. */
-
-/* An example of writing a C++ virtual function in Go. */
-
-%module(directors="1") callback
-
-%{
-#include <string>
-#include "callback.h"
-%}
-
-%include "std_string.i"
-
-%feature("director");
-
-%include "callback.h"
diff --git a/misc/swig/callback/run b/misc/swig/callback/run
deleted file mode 100755
index de150ed05..000000000
--- a/misc/swig/callback/run
+++ /dev/null
Binary files differ
diff --git a/misc/swig/callback/run.go b/misc/swig/callback/run.go
deleted file mode 100644
index a76e636cb..000000000
--- a/misc/swig/callback/run.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.
-
-package main
-
-import (
- "swig/callback"
- "fmt"
-)
-
-type GoCallback struct{}
-
-func (p *GoCallback) Run() string {
- return "GoCallback.Run"
-}
-
-func main() {
- c := callback.NewCaller()
- cb := callback.NewCallback()
-
- c.SetCallback(cb)
- s := c.Call()
- fmt.Println(s)
- if s != "Callback::run" {
- panic(s)
- }
- c.DelCallback()
-
- cb = callback.NewDirectorCallback(&GoCallback{})
- c.SetCallback(cb)
- s = c.Call()
- fmt.Println(s)
- if s != "GoCallback.Run" {
- panic(s)
- }
- c.DelCallback()
- callback.DeleteDirectorCallback(cb)
-}