aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Godeps/Godeps.json8
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/README.md12
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/app.go14
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go14
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go28
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/command.go21
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go4
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/context.go5
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go12
-rw-r--r--Godeps/_workspace/src/github.com/codegangsta/cli/help.go25
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake14
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/cl.hpp1582
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp3
-rw-r--r--blockpool/blockpool.go13
-rw-r--r--blockpool/peers.go9
-rw-r--r--blockpool/peers_test.go5
-rw-r--r--cmd/ethereum/js.go22
-rw-r--r--cmd/ethereum/js_test.go16
-rw-r--r--cmd/ethereum/main.go4
-rw-r--r--cmd/mist/assets/examples/coin.html2
m---------cmd/mist/assets/ext/ethereum.js0
-rw-r--r--eth/backend.go4
-rw-r--r--jsre/ethereum_js.go2
-rw-r--r--jsre/jsre.go12
-rw-r--r--jsre/pp_js.go29
-rw-r--r--miner/worker.go38
-rw-r--r--rpc/jeth.go6
27 files changed, 1222 insertions, 682 deletions
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index ef013c75f..88d34944b 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -17,13 +17,13 @@
},
{
"ImportPath": "github.com/codegangsta/cli",
- "Comment": "1.2.0-81-g3e09053",
- "Rev": "3e0905345cd2c5366530dbcdce62457f2ce16e7c"
+ "Comment": "1.2.0-95-g9b2bd2b",
+ "Rev": "9b2bd2b3489748d4d0a204fa4eb2ee9e89e0ebc6"
},
{
"ImportPath": "github.com/ethereum/ethash",
- "Comment": "v23.1-26-g934bb4f",
- "Rev": "934bb4f5060ab69d96fb6eba4b9a57facc4e160b"
+ "Comment": "v23.1-30-gf8a0565",
+ "Rev": "f8a0565cc3a20c5ad82dec3ec612645356069641"
},
{
"ImportPath": "github.com/ethereum/serpent-go",
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/README.md b/Godeps/_workspace/src/github.com/codegangsta/cli/README.md
index c0bb338ab..4b3ddb0a3 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/README.md
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/README.md
@@ -210,7 +210,7 @@ Subcommands can be defined for a more git-like command line app.
app.Commands = []cli.Command{
{
Name: "add",
- ShortName: "a",
+ Aliases: []string{"a"},
Usage: "add a task to the list",
Action: func(c *cli.Context) {
println("added task: ", c.Args().First())
@@ -218,7 +218,7 @@ app.Commands = []cli.Command{
},
{
Name: "complete",
- ShortName: "c",
+ Aliases: []string{"c"},
Usage: "complete a task on the list",
Action: func(c *cli.Context) {
println("completed task: ", c.Args().First())
@@ -226,7 +226,7 @@ app.Commands = []cli.Command{
},
{
Name: "template",
- ShortName: "r",
+ Aliases: []string{"r"},
Usage: "options for task templates",
Subcommands: []cli.Command{
{
@@ -244,7 +244,7 @@ app.Commands = []cli.Command{
},
},
},
- },
+ },
}
...
```
@@ -262,8 +262,8 @@ app := cli.NewApp()
app.EnableBashCompletion = true
app.Commands = []cli.Command{
{
- Name: "complete",
- ShortName: "c",
+ Name: "complete",
+ Aliases: []string{"c"},
Usage: "complete a task on the list",
Action: func(c *cli.Context) {
println("completed task: ", c.Args().First())
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/app.go b/Godeps/_workspace/src/github.com/codegangsta/cli/app.go
index 3e7d5a63c..cd2900519 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/app.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/app.go
@@ -5,6 +5,7 @@ import (
"io"
"io/ioutil"
"os"
+ "strings"
"text/tabwriter"
"text/template"
"time"
@@ -72,17 +73,14 @@ func NewApp() *App {
BashComplete: DefaultAppComplete,
Action: helpCommand.Action,
Compiled: compileTime(),
- Author: "Dr. James",
- Email: "who@gmail.com",
- Authors: []Author{{"Jim", "jim@corporate.com"}, {"Hank", "hank@indiepalace.com"}},
Writer: os.Stdout,
}
}
// Entry point to the cli app. Parses the arguments slice and routes to the proper flag/args combination
func (a *App) Run(arguments []string) (err error) {
- if a.Author != "" && a.Author != "" {
- a.Authors = append(a.Authors, Author{a.Author, a.Email})
+ if a.Author != "" || a.Email != "" {
+ a.Authors = append(a.Authors, Author{Name: a.Author, Email: a.Email})
}
if HelpPrinter == nil {
@@ -91,8 +89,12 @@ func (a *App) Run(arguments []string) (err error) {
}()
HelpPrinter = func(templ string, data interface{}) {
+ funcMap := template.FuncMap{
+ "join": strings.Join,
+ }
+
w := tabwriter.NewWriter(a.Writer, 0, 8, 1, '\t', 0)
- t := template.Must(template.New("help").Parse(templ))
+ t := template.Must(template.New("help").Funcs(funcMap).Parse(templ))
err := t.Execute(w, data)
if err != nil {
panic(err)
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go b/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
index 6143d364b..4a40b89cd 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/app_test.go
@@ -23,7 +23,7 @@ func ExampleApp() {
}
app.Author = "Harrison"
app.Email = "harrison@lolwut.com"
- app.Authors = []cli.Author{{"Oliver Allen", "oliver@toyshop.com"}}
+ app.Authors = []cli.Author{cli.Author{Name: "Oliver Allen", Email: "oliver@toyshop.com"}}
app.Run(os.Args)
// Output:
// Hello Jeremy
@@ -37,13 +37,13 @@ func ExampleAppSubcommand() {
app.Commands = []cli.Command{
{
Name: "hello",
- ShortName: "hi",
+ Aliases: []string{"hi"},
Usage: "use it to see a description",
Description: "This is how we describe hello the function",
Subcommands: []cli.Command{
{
Name: "english",
- ShortName: "en",
+ Aliases: []string{"en"},
Usage: "sends a greeting in english",
Description: "greets someone in english",
Flags: []cli.Flag{
@@ -78,7 +78,7 @@ func ExampleAppHelp() {
app.Commands = []cli.Command{
{
Name: "describeit",
- ShortName: "d",
+ Aliases: []string{"d"},
Usage: "use it to see a description",
Description: "This is how we describe describeit the function",
Action: func(c *cli.Context) {
@@ -108,7 +108,7 @@ func ExampleAppBashComplete() {
app.Commands = []cli.Command{
{
Name: "describeit",
- ShortName: "d",
+ Aliases: []string{"d"},
Usage: "use it to see a description",
Description: "This is how we describe describeit the function",
Action: func(c *cli.Context) {
@@ -162,8 +162,8 @@ var commandAppTests = []struct {
func TestApp_Command(t *testing.T) {
app := cli.NewApp()
- fooCommand := cli.Command{Name: "foobar", ShortName: "f"}
- batCommand := cli.Command{Name: "batbaz", ShortName: "b"}
+ fooCommand := cli.Command{Name: "foobar", Aliases: []string{"f"}}
+ batCommand := cli.Command{Name: "batbaz", Aliases: []string{"b"}}
app.Commands = []cli.Command{
fooCommand,
batCommand,
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go b/Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go
index 879a793dc..8a8df9736 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/cli_test.go
@@ -12,17 +12,17 @@ func Example() {
app.Usage = "task list on the command line"
app.Commands = []cli.Command{
{
- Name: "add",
- ShortName: "a",
- Usage: "add a task to the list",
+ Name: "add",
+ Aliases: []string{"a"},
+ Usage: "add a task to the list",
Action: func(c *cli.Context) {
println("added task: ", c.Args().First())
},
},
{
- Name: "complete",
- ShortName: "c",
- Usage: "complete a task on the list",
+ Name: "complete",
+ Aliases: []string{"c"},
+ Usage: "complete a task on the list",
Action: func(c *cli.Context) {
println("completed task: ", c.Args().First())
},
@@ -38,13 +38,13 @@ func ExampleSubcommand() {
app.Commands = []cli.Command{
{
Name: "hello",
- ShortName: "hi",
+ Aliases: []string{"hi"},
Usage: "use it to see a description",
Description: "This is how we describe hello the function",
Subcommands: []cli.Command{
{
Name: "english",
- ShortName: "en",
+ Aliases: []string{"en"},
Usage: "sends a greeting in english",
Description: "greets someone in english",
Flags: []cli.Flag{
@@ -58,9 +58,9 @@ func ExampleSubcommand() {
println("Hello, ", c.String("name"))
},
}, {
- Name: "spanish",
- ShortName: "sp",
- Usage: "sends a greeting in spanish",
+ Name: "spanish",
+ Aliases: []string{"sp"},
+ Usage: "sends a greeting in spanish",
Flags: []cli.Flag{
cli.StringFlag{
Name: "surname",
@@ -72,9 +72,9 @@ func ExampleSubcommand() {
println("Hola, ", c.String("surname"))
},
}, {
- Name: "french",
- ShortName: "fr",
- Usage: "sends a greeting in french",
+ Name: "french",
+ Aliases: []string{"fr"},
+ Usage: "sends a greeting in french",
Flags: []cli.Flag{
cli.StringFlag{
Name: "nickname",
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/command.go b/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
index 07c919a87..b61691c86 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/command.go
@@ -10,8 +10,10 @@ import (
type Command struct {
// The name of the command
Name string
- // short name of the command. Typically one character
+ // short name of the command. Typically one character (deprecated, use `Aliases`)
ShortName string
+ // A list of aliases for the command
+ Aliases []string
// A short description of the usage of this command
Usage string
// A longer explanation of how the command works
@@ -117,9 +119,24 @@ func (c Command) Run(ctx *Context) error {
return nil
}
+func (c Command) Names() []string {
+ names := []string{c.Name}
+
+ if c.ShortName != "" {
+ names = append(names, c.ShortName)
+ }
+
+ return append(names, c.Aliases...)
+}
+
// Returns true if Command.Name or Command.ShortName matches given name
func (c Command) HasName(name string) bool {
- return c.Name == name || (c.ShortName != "" && c.ShortName == name)
+ for _, n := range c.Names() {
+ if n == name {
+ return true
+ }
+ }
+ return false
}
func (c Command) startApp(ctx *Context) error {
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go b/Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go
index c0f556ad2..4125b0c1b 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/command_test.go
@@ -17,7 +17,7 @@ func TestCommandDoNotIgnoreFlags(t *testing.T) {
command := cli.Command{
Name: "test-cmd",
- ShortName: "tc",
+ Aliases: []string{"tc"},
Usage: "this is for testing",
Description: "testing",
Action: func(_ *cli.Context) {},
@@ -37,7 +37,7 @@ func TestCommandIgnoreFlags(t *testing.T) {
command := cli.Command{
Name: "test-cmd",
- ShortName: "tc",
+ Aliases: []string{"tc"},
Usage: "this is for testing",
Description: "testing",
Action: func(_ *cli.Context) {},
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/context.go b/Godeps/_workspace/src/github.com/codegangsta/cli/context.go
index c9f645b18..37221bdc2 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/context.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/context.go
@@ -106,6 +106,11 @@ func (c *Context) GlobalGeneric(name string) interface{} {
return lookupGeneric(name, c.globalSet)
}
+// Returns the number of flags set
+func (c *Context) NumFlags() int {
+ return c.flagSet.NFlag()
+}
+
// Determines if the flag was actually set
func (c *Context) IsSet(name string) bool {
if c.setFlags == nil {
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go b/Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go
index 7c9a4436f..d4a1877f0 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/context_test.go
@@ -97,3 +97,15 @@ func TestContext_GlobalIsSet(t *testing.T) {
expect(t, c.GlobalIsSet("myflagGlobalUnset"), false)
expect(t, c.GlobalIsSet("bogusGlobal"), false)
}
+
+func TestContext_NumFlags(t *testing.T) {
+ set := flag.NewFlagSet("test", 0)
+ set.Bool("myflag", false, "doc")
+ set.String("otherflag", "hello world", "doc")
+ globalSet := flag.NewFlagSet("test", 0)
+ globalSet.Bool("myflagGlobal", true, "doc")
+ c := cli.NewContext(nil, set, globalSet)
+ set.Parse([]string{"--myflag", "--otherflag=foo"})
+ globalSet.Parse([]string{"--myflagGlobal"})
+ expect(t, c.NumFlags(), 2)
+}
diff --git a/Godeps/_workspace/src/github.com/codegangsta/cli/help.go b/Godeps/_workspace/src/github.com/codegangsta/cli/help.go
index 8d176556a..7c4f81be6 100644
--- a/Godeps/_workspace/src/github.com/codegangsta/cli/help.go
+++ b/Godeps/_workspace/src/github.com/codegangsta/cli/help.go
@@ -15,10 +15,10 @@ VERSION:
{{.Version}}
AUTHOR(S):
- {{range .Authors}}{{ . }} {{end}}
-
+ {{range .Authors}}{{ . }}
+ {{end}}
COMMANDS:
- {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
+ {{range .Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
{{end}}{{if .Flags}}
GLOBAL OPTIONS:
{{range .Flags}}{{.}}
@@ -52,7 +52,7 @@ USAGE:
{{.Name}} command{{if .Flags}} [command options]{{end}} [arguments...]
COMMANDS:
- {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
+ {{range .Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
{{end}}{{if .Flags}}
OPTIONS:
{{range .Flags}}{{.}}
@@ -60,9 +60,9 @@ OPTIONS:
`
var helpCommand = Command{
- Name: "help",
- ShortName: "h",
- Usage: "Shows a list of commands or help for one command",
+ Name: "help",
+ Aliases: []string{"h"},
+ Usage: "Shows a list of commands or help for one command",
Action: func(c *Context) {
args := c.Args()
if args.Present() {
@@ -74,9 +74,9 @@ var helpCommand = Command{
}
var helpSubcommand = Command{
- Name: "help",
- ShortName: "h",
- Usage: "Shows a list of commands or help for one command",
+ Name: "help",
+ Aliases: []string{"h"},
+ Usage: "Shows a list of commands or help for one command",
Action: func(c *Context) {
args := c.Args()
if args.Present() {
@@ -102,9 +102,8 @@ func ShowAppHelp(c *Context) {
// Prints the list of subcommands as the default app completion method
func DefaultAppComplete(c *Context) {
for _, command := range c.App.Commands {
- fmt.Fprintln(c.App.Writer, command.Name)
- if command.ShortName != "" {
- fmt.Fprintln(c.App.Writer, command.ShortName)
+ for _, name := range command.Names() {
+ fmt.Fprintln(c.App.Writer, name)
}
}
}
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake
index 4d3ed842c..415c95dbd 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake
@@ -118,7 +118,19 @@ if(WIN32)
endif()
else()
find_library(OpenCL_LIBRARY
- NAMES OpenCL)
+ NAMES OpenCL
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV CUDA_PATH
+ ENV NVSDKCOMPUTE_ROOT
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ "AMD APP/lib/x86_64"
+ lib/x86_64
+ lib/x64
+ OpenCL/common/lib/x64)
endif()
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/cl.hpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/cl.hpp
index 38fac1962..5c9be5c5e 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/cl.hpp
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/cl.hpp
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2013 The Khronos Group Inc.
+ * Copyright (c) 2008-2015 The Khronos Group Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
@@ -33,8 +33,8 @@
* Bruce Merry, February 2013.
* Tom Deakin and Simon McIntosh-Smith, July 2013
*
- * \version 1.2.6
- * \date August 2013
+ * \version 1.2.7
+ * \date January 2015
*
* Optional extension support
*
@@ -147,37 +147,42 @@
#ifdef _WIN32
-#include <windows.h>
#include <malloc.h>
-#include <iterator>
-#include <intrin.h>
-#if defined(__CL_ENABLE_EXCEPTIONS)
-#include <exception>
-#endif // #if defined(__CL_ENABLE_EXCEPTIONS)
-
-#pragma push_macro("max")
-#undef max
#if defined(USE_DX_INTEROP)
#include <CL/cl_d3d10.h>
#include <CL/cl_dx9_media_sharing.h>
#endif
#endif // _WIN32
+#if defined(_MSC_VER)
+#include <intrin.h>
+#endif // _MSC_VER
+
//
#if defined(USE_CL_DEVICE_FISSION)
#include <CL/cl_ext.h>
#endif
#if defined(__APPLE__) || defined(__MACOSX)
-#include <OpenGL/OpenGL.h>
#include <OpenCL/opencl.h>
-#include <libkern/OSAtomic.h>
#else
-#include <GL/gl.h>
#include <CL/opencl.h>
#endif // !__APPLE__
+#if (_MSC_VER >= 1700) || (__cplusplus >= 201103L)
+#define CL_HPP_RVALUE_REFERENCES_SUPPORTED
+#define CL_HPP_CPP11_ATOMICS_SUPPORTED
+#include <atomic>
+#endif
+
+#if (__cplusplus >= 201103L)
+#define CL_HPP_NOEXCEPT noexcept
+#else
+#define CL_HPP_NOEXCEPT
+#endif
+
+
// To avoid accidentally taking ownership of core OpenCL types
// such as cl_kernel constructors are made explicit
// under OpenCL 1.2
@@ -202,6 +207,11 @@
#include <utility>
#include <limits>
+#include <iterator>
+
+#if defined(__CL_ENABLE_EXCEPTIONS)
+#include <exception>
+#endif // #if defined(__CL_ENABLE_EXCEPTIONS)
#if !defined(__NO_STD_VECTOR)
#include <vector>
@@ -211,11 +221,8 @@
#include <string>
#endif
-#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
+#if defined(__ANDROID__) || defined(linux) || defined(__APPLE__) || defined(__MACOSX)
#include <alloca.h>
-
-#include <emmintrin.h>
-#include <xmmintrin.h>
#endif // linux
#include <cstring>
@@ -389,7 +396,7 @@ static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
#define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
#if defined(CL_VERSION_1_2)
#define __COMPILE_PROGRAM_ERR __ERR_STR(clCompileProgram)
-
+#define __LINK_PROGRAM_ERR __ERR_STR(clLinkProgram)
#endif // #if defined(CL_VERSION_1_2)
#define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
@@ -546,7 +553,7 @@ public:
}
else {
char *newString = new char[n + 1];
- int copySize = n;
+ ::size_t copySize = n;
if( size_ < n ) {
copySize = size_;
}
@@ -676,7 +683,7 @@ typedef cl::string STRING_CLASS;
* \param N maximum size of the vector.
*/
template <typename T, unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
-class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED vector CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
+class CL_EXT_PREFIX__VERSION_1_1_DEPRECATED vector
{
private:
T data_[N];
@@ -718,7 +725,7 @@ public:
*/
void push_back (const T& x)
{
- if (size() < N) {
+ if (size() < N) {
new (&data_[size_]) T(x);
size_++;
} else {
@@ -739,7 +746,7 @@ public:
detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
}
}
-
+
/*! \brief Constructs with a value copied from another.
*
* \param vec the vector to copy.
@@ -747,7 +754,7 @@ public:
vector(const vector<T, N>& vec) :
size_(vec.size_)
{
- if (size_ != 0) {
+ if (size_ != 0) {
assign(vec.begin(), vec.end());
}
}
@@ -784,7 +791,7 @@ public:
} else {
clear();
}
-
+
return *this;
}
@@ -830,6 +837,28 @@ public:
return N;
}
+ //! \brief Resizes the vector to the given size
+ void resize(unsigned int newSize, T fill = T())
+ {
+ if (newSize > N)
+ {
+ detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
+ }
+ else
+ {
+ while (size_ < newSize)
+ {
+ new (&data_[size_]) T(fill);
+ size_++;
+ }
+ while (size_ > newSize)
+ {
+ --size_;
+ data_[size_].~T();
+ }
+ }
+ }
+
/*! \brief Returns a reference to a given element.
*
* \param index which element to access. *
@@ -1006,7 +1035,7 @@ public:
{
return data_[size_-1];
}
-};
+} CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
#endif // #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
@@ -1021,25 +1050,39 @@ namespace detail {
/*
* Compare and exchange primitives are needed for handling of defaults
*/
+
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ inline int compare_exchange(std::atomic<int> * dest, int exchange, int comparand)
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
inline int compare_exchange(volatile int * dest, int exchange, int comparand)
- {
-#ifdef _WIN32
- return (int)(InterlockedCompareExchange(
- (volatile long*)dest,
- (long)exchange,
- (long)comparand));
-#elif defined(__APPLE__) || defined(__MACOSX)
- return OSAtomicOr32Orig((uint32_t)exchange, (volatile uint32_t*)dest);
-#else // !_WIN32 || defined(__APPLE__) || defined(__MACOSX)
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ {
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ std::atomic_compare_exchange_strong(dest, &comparand, exchange);
+ return comparand;
+#elif _MSC_VER
+ return (int)(_InterlockedCompareExchange(
+ (volatile long*)dest,
+ (long)exchange,
+ (long)comparand));
+#else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
return (__sync_val_compare_and_swap(
- dest,
- comparand,
+ dest,
+ comparand,
exchange));
-#endif // !_WIN32
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
}
- inline void fence() { _mm_mfence(); }
-}; // namespace detail
+ inline void fence() {
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ std::atomic_thread_fence(std::memory_order_seq_cst);
+#elif _MSC_VER // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ _ReadWriteBarrier();
+#else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ __sync_synchronize();
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
+ }
+} // namespace detail
/*! \brief class used to interface between C++ and
@@ -1169,13 +1212,16 @@ inline cl_int getInfoHelper(Func f, cl_uint name, STRING_CLASS* param, long)
return err;
}
- char* value = (char*) alloca(required);
- err = f(name, required, value, NULL);
+ // std::string has a constant data member
+ // a char vector does not
+ VECTOR_CLASS<char> value(required);
+ err = f(name, required, value.data(), NULL);
if (err != CL_SUCCESS) {
return err;
}
-
- *param = value;
+ if (param) {
+ param->assign(value.begin(), value.end());
+ }
return CL_SUCCESS;
}
@@ -1294,7 +1340,7 @@ inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_
F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
- F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_uint) \
+ F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_int) \
\
F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
@@ -1675,7 +1721,7 @@ static cl_uint getVersion(const char *versionInfo)
++index;
}
++index;
- while(versionInfo[index] != ' ' ) {
+ while(versionInfo[index] != ' ' && versionInfo[index] != '\0') {
lowVersion *= 10;
lowVersion += versionInfo[index]-'0';
++index;
@@ -1739,14 +1785,36 @@ public:
if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
}
- Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT
{
- if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
object_ = rhs.object_;
- if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ rhs.object_ = NULL;
+ }
+#endif
+
+ Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ }
return *this;
}
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ rhs.object_ = NULL;
+ }
+ return *this;
+ }
+#endif
+
Wrapper<cl_type>& operator = (const cl_type &rhs)
{
if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
@@ -1817,15 +1885,41 @@ public:
if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
}
- Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper(Wrapper<cl_type>&& rhs) CL_HPP_NOEXCEPT
{
- if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
object_ = rhs.object_;
referenceCountable_ = rhs.referenceCountable_;
- if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ rhs.object_ = NULL;
+ rhs.referenceCountable_ = false;
+ }
+#endif
+
+ Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
+ }
return *this;
}
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ Wrapper<cl_type>& operator = (Wrapper<cl_type>&& rhs)
+ {
+ if (this != &rhs) {
+ if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
+ object_ = rhs.object_;
+ referenceCountable_ = rhs.referenceCountable_;
+ rhs.object_ = NULL;
+ rhs.referenceCountable_ = false;
+ }
+ return *this;
+ }
+#endif
+
Wrapper<cl_type>& operator = (const cl_type &rhs)
{
if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
@@ -1910,17 +2004,11 @@ public:
//! \brief Default constructor - initializes to NULL.
Device() : detail::Wrapper<cl_type>() { }
- /*! \brief Copy constructor.
- *
- * This simply copies the device ID value, which is an inexpensive operation.
- */
- Device(const Device& device) : detail::Wrapper<cl_type>(device) { }
-
/*! \brief Constructor from cl_device_id.
*
* This simply copies the device ID value, which is an inexpensive operation.
*/
- Device(const cl_device_id &device) : detail::Wrapper<cl_type>(device) { }
+ __CL_EXPLICIT_CONSTRUCTORS Device(const cl_device_id &device) : detail::Wrapper<cl_type>(device) { }
/*! \brief Returns the first device on the default context.
*
@@ -1928,28 +2016,46 @@ public:
*/
static Device getDefault(cl_int * err = NULL);
- /*! \brief Assignment operator from Device.
+ /*! \brief Assignment operator from cl_device_id.
*
* This simply copies the device ID value, which is an inexpensive operation.
*/
- Device& operator = (const Device& rhs)
+ Device& operator = (const cl_device_id& rhs)
{
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
+ detail::Wrapper<cl_type>::operator=(rhs);
return *this;
}
- /*! \brief Assignment operator from cl_device_id.
- *
- * This simply copies the device ID value, which is an inexpensive operation.
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Device& operator = (const cl_device_id& rhs)
+ Device(const Device& dev) : detail::Wrapper<cl_type>(dev) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device& operator = (const Device &dev)
{
- detail::Wrapper<cl_type>::operator=(rhs);
+ detail::Wrapper<cl_type>::operator=(dev);
return *this;
}
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device(Device&& dev) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(dev)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Device& operator = (Device &&dev)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(dev));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
//! \brief Wrapper for clGetDeviceInfo().
template <typename T>
cl_int getInfo(cl_device_info name, T* param) const
@@ -2051,29 +2157,11 @@ public:
//! \brief Default constructor - initializes to NULL.
Platform() : detail::Wrapper<cl_type>() { }
- /*! \brief Copy constructor.
- *
- * This simply copies the platform ID value, which is an inexpensive operation.
- */
- Platform(const Platform& platform) : detail::Wrapper<cl_type>(platform) { }
-
/*! \brief Constructor from cl_platform_id.
*
* This simply copies the platform ID value, which is an inexpensive operation.
*/
- Platform(const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { }
-
- /*! \brief Assignment operator from Platform.
- *
- * This simply copies the platform ID value, which is an inexpensive operation.
- */
- Platform& operator = (const Platform& rhs)
- {
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
- return *this;
- }
+ __CL_EXPLICIT_CONSTRUCTORS Platform(const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { }
/*! \brief Assignment operator from cl_platform_id.
*
@@ -2284,6 +2372,7 @@ public:
if (errResult != NULL) {
*errResult = err;
}
+ return Platform();
}
cl_platform_id* ids = (cl_platform_id*) alloca(
@@ -2292,13 +2381,14 @@ public:
if (err != CL_SUCCESS) {
detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ if (errResult != NULL) {
+ *errResult = err;
+ }
+ return Platform();
}
- if (errResult != NULL) {
- *errResult = err;
- }
- return ids[0];
+ return Platform(ids[0]);
}
static Platform getDefault(
@@ -2347,16 +2437,15 @@ class Context
: public detail::Wrapper<cl_context>
{
private:
+
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static std::atomic<int> default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
static volatile int default_initialized_;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
static Context default_;
static volatile cl_int default_error_;
public:
- /*! \brief Destructor.
- *
- * This calls clReleaseContext() on the value held by this instance.
- */
- ~Context() { }
-
/*! \brief Constructs a context including a list of specified devices.
*
* Wraps clCreateContext().
@@ -2434,7 +2523,7 @@ public:
{
cl_int error;
-#if !defined(__APPLE__) || !defined(__MACOS)
+#if !defined(__APPLE__) && !defined(__MACOS)
cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
if (properties == NULL) {
@@ -2502,6 +2591,36 @@ public:
}
}
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context(const Context& ctx) : detail::Wrapper<cl_type>(ctx) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context& operator = (const Context &ctx)
+ {
+ detail::Wrapper<cl_type>::operator=(ctx);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context(Context&& ctx) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(ctx)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Context& operator = (Context &&ctx)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(ctx));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
/*! \brief Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.
*
* \note All calls to this function return the same cl_context as the first.
@@ -2557,12 +2676,6 @@ public:
//! \brief Default constructor - initializes to NULL.
Context() : detail::Wrapper<cl_type>() { }
- /*! \brief Copy constructor.
- *
- * This calls clRetainContext() on the parameter's cl_context.
- */
- Context(const Context& context) : detail::Wrapper<cl_type>(context) { }
-
/*! \brief Constructor from cl_context - takes ownership.
*
* This effectively transfers ownership of a refcount on the cl_context
@@ -2570,19 +2683,6 @@ public:
*/
__CL_EXPLICIT_CONSTRUCTORS Context(const cl_context& context) : detail::Wrapper<cl_type>(context) { }
- /*! \brief Assignment operator from Context.
- *
- * This calls clRetainContext() on the parameter and clReleaseContext() on
- * the previous value held by this instance.
- */
- Context& operator = (const Context& rhs)
- {
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
- return *this;
- }
-
/*! \brief Assignment operator from cl_context - takes ownership.
*
* This effectively transfers ownership of a refcount on the rhs and calls
@@ -2662,7 +2762,7 @@ inline Device Device::getDefault(cl_int * err)
Device device;
Context context = Context::getDefault(&error);
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
if (error != CL_SUCCESS) {
if (err != NULL) {
@@ -2681,14 +2781,22 @@ inline Device Device::getDefault(cl_int * err)
#ifdef _WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) std::atomic<int> Context::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__declspec(selectany) volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__declspec(selectany) Context Context::default_;
__declspec(selectany) volatile cl_int Context::default_error_ = CL_SUCCESS;
-#else
+#else // !_WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) std::atomic<int> Context::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__attribute__((weak)) volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__attribute__((weak)) Context Context::default_;
__attribute__((weak)) volatile cl_int Context::default_error_ = CL_SUCCESS;
-#endif
+#endif // !_WIN32
/*! \brief Class interface for cl_event.
*
@@ -2701,46 +2809,21 @@ __attribute__((weak)) volatile cl_int Context::default_error_ = CL_SUCCESS;
class Event : public detail::Wrapper<cl_event>
{
public:
- /*! \brief Destructor.
- *
- * This calls clReleaseEvent() on the value held by this instance.
- */
- ~Event() { }
-
//! \brief Default constructor - initializes to NULL.
Event() : detail::Wrapper<cl_type>() { }
- /*! \brief Copy constructor.
- *
- * This calls clRetainEvent() on the parameter's cl_event.
- */
- Event(const Event& event) : detail::Wrapper<cl_type>(event) { }
-
/*! \brief Constructor from cl_event - takes ownership.
*
* This effectively transfers ownership of a refcount on the cl_event
* into the new Event object.
*/
- Event(const cl_event& event) : detail::Wrapper<cl_type>(event) { }
+ __CL_EXPLICIT_CONSTRUCTORS Event(const cl_event& event) : detail::Wrapper<cl_type>(event) { }
/*! \brief Assignment operator from cl_event - takes ownership.
*
* This effectively transfers ownership of a refcount on the rhs and calls
* clReleaseEvent() on the value previously held by this instance.
*/
- Event& operator = (const Event& rhs)
- {
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
- return *this;
- }
-
- /*! \brief Assignment operator from cl_event.
- *
- * This calls clRetainEvent() on the parameter and clReleaseEvent() on
- * the previous value held by this instance.
- */
Event& operator = (const cl_event& rhs)
{
detail::Wrapper<cl_type>::operator=(rhs);
@@ -2833,7 +2916,7 @@ public:
{
return detail::errHandler(
::clWaitForEvents(
- (cl_uint) events.size(), (cl_event*)&events.front()),
+ (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
__WAIT_FOR_EVENTS_ERR);
}
};
@@ -2868,18 +2951,6 @@ public:
//! \brief Default constructor - initializes to NULL.
UserEvent() : Event() { }
- //! \brief Copy constructor - performs shallow copy.
- UserEvent(const UserEvent& event) : Event(event) { }
-
- //! \brief Assignment Operator - performs shallow copy.
- UserEvent& operator = (const UserEvent& rhs)
- {
- if (this != &rhs) {
- Event::operator=(rhs);
- }
- return *this;
- }
-
/*! \brief Sets the execution status of a user event object.
*
* Wraps clSetUserEventStatus().
@@ -2902,7 +2973,7 @@ WaitForEvents(const VECTOR_CLASS<Event>& events)
{
return detail::errHandler(
::clWaitForEvents(
- (cl_uint) events.size(), (cl_event*)&events.front()),
+ (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
__WAIT_FOR_EVENTS_ERR);
}
@@ -2917,22 +2988,9 @@ WaitForEvents(const VECTOR_CLASS<Event>& events)
class Memory : public detail::Wrapper<cl_mem>
{
public:
-
- /*! \brief Destructor.
- *
- * This calls clReleaseMemObject() on the value held by this instance.
- */
- ~Memory() {}
-
//! \brief Default constructor - initializes to NULL.
Memory() : detail::Wrapper<cl_type>() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * This calls clRetainMemObject() on the parameter's cl_mem.
- */
- Memory(const Memory& memory) : detail::Wrapper<cl_type>(memory) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* This effectively transfers ownership of a refcount on the cl_mem
@@ -2940,19 +2998,6 @@ public:
*/
__CL_EXPLICIT_CONSTRUCTORS Memory(const cl_mem& memory) : detail::Wrapper<cl_type>(memory) { }
- /*! \brief Assignment operator from Memory.
- *
- * This calls clRetainMemObject() on the parameter and clReleaseMemObject()
- * on the previous value held by this instance.
- */
- Memory& operator = (const Memory& rhs)
- {
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
- return *this;
- }
-
/*! \brief Assignment operator from cl_mem - takes ownership.
*
* This effectively transfers ownership of a refcount on the rhs and calls
@@ -2964,6 +3009,36 @@ public:
return *this;
}
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory(const Memory& mem) : detail::Wrapper<cl_type>(mem) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory& operator = (const Memory &mem)
+ {
+ detail::Wrapper<cl_type>::operator=(mem);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory(Memory&& mem) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(mem)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Memory& operator = (Memory &&mem)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(mem));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
//! \brief Wrapper for clGetMemObjectInfo().
template <typename T>
cl_int getInfo(cl_mem_info name, T* param) const
@@ -3148,42 +3223,62 @@ public:
Buffer(const Context &context, IteratorType startIterator, IteratorType endIterator,
bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
+ /*!
+ * \brief Construct a Buffer from a host container via iterators using a specified queue.
+ * If useHostPtr is specified iterators must represent contiguous data.
+ */
+ template< typename IteratorType >
+ Buffer(const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
+ bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
+
//! \brief Default constructor - initializes to NULL.
Buffer() : Memory() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- Buffer(const Buffer& buffer) : Memory(buffer) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS Buffer(const cl_mem& buffer) : Memory(buffer) { }
- /*! \brief Assignment from Buffer - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- Buffer& operator = (const Buffer& rhs)
+ Buffer& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Memory::operator=(rhs);
- }
+ Memory::operator=(rhs);
return *this;
}
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer(const Buffer& buf) : Memory(buf) {}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Buffer& operator = (const cl_mem& rhs)
+ Buffer& operator = (const Buffer &buf)
{
- Memory::operator=(rhs);
+ Memory::operator=(buf);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer(Buffer&& buf) CL_HPP_NOEXCEPT : Memory(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Buffer& operator = (Buffer &&buf)
+ {
+ Memory::operator=(std::move(buf));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
#if defined(CL_VERSION_1_1)
/*! \brief Creates a new buffer object from this.
@@ -3274,39 +3369,51 @@ public:
//! \brief Default constructor - initializes to NULL.
BufferD3D10() : Buffer() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- BufferD3D10(const BufferD3D10& buffer) : Buffer(buffer) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS BufferD3D10(const cl_mem& buffer) : Buffer(buffer) { }
- /*! \brief Assignment from BufferD3D10 - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- BufferD3D10& operator = (const BufferD3D10& rhs)
+ BufferD3D10& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Buffer::operator=(rhs);
- }
+ Buffer::operator=(rhs);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
- */
- BufferD3D10& operator = (const cl_mem& rhs)
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10(const BufferD3D10& buf) : Buffer(buf) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10& operator = (const BufferD3D10 &buf)
{
- Buffer::operator=(rhs);
+ Buffer::operator=(buf);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferD3D10& operator = (BufferD3D10 &&buf)
+ {
+ Buffer::operator=(std::move(buf));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
#endif
@@ -3329,7 +3436,7 @@ public:
BufferGL(
const Context& context,
cl_mem_flags flags,
- GLuint bufobj,
+ cl_GLuint bufobj,
cl_int * err = NULL)
{
cl_int error;
@@ -3348,30 +3455,12 @@ public:
//! \brief Default constructor - initializes to NULL.
BufferGL() : Buffer() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- BufferGL(const BufferGL& buffer) : Buffer(buffer) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS BufferGL(const cl_mem& buffer) : Buffer(buffer) { }
- /*! \brief Assignment from BufferGL - performs shallow copy.
- *
- * See Memory for further details.
- */
- BufferGL& operator = (const BufferGL& rhs)
- {
- if (this != &rhs) {
- Buffer::operator=(rhs);
- }
- return *this;
- }
-
/*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
@@ -3382,93 +3471,40 @@ public:
return *this;
}
- //! \brief Wrapper for clGetGLObjectInfo().
- cl_int getObjectInfo(
- cl_gl_object_type *type,
- GLuint * gl_object_name)
- {
- return detail::errHandler(
- ::clGetGLObjectInfo(object_,type,gl_object_name),
- __GET_GL_OBJECT_INFO_ERR);
- }
-};
-
-/*! \brief Class interface for GL Render Buffer Memory Objects.
- *
- * This is provided to facilitate interoperability with OpenGL.
- *
- * See Memory for details about copy semantics, etc.
- *
- * \see Memory
- */
-class BufferRenderGL : public Buffer
-{
-public:
- /*! \brief Constructs a BufferRenderGL in a specified context, from a given
- * GL Renderbuffer.
- *
- * Wraps clCreateFromGLRenderbuffer().
- */
- BufferRenderGL(
- const Context& context,
- cl_mem_flags flags,
- GLuint bufobj,
- cl_int * err = NULL)
- {
- cl_int error;
- object_ = ::clCreateFromGLRenderbuffer(
- context(),
- flags,
- bufobj,
- &error);
-
- detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
- if (err != NULL) {
- *err = error;
- }
- }
-
- //! \brief Default constructor - initializes to NULL.
- BufferRenderGL() : Buffer() { }
-
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- BufferRenderGL(const BufferGL& buffer) : Buffer(buffer) { }
-
- /*! \brief Constructor from cl_mem - takes ownership.
- *
- * See Memory for further details.
- */
- __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : Buffer(buffer) { }
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL(const BufferGL& buf) : Buffer(buf) {}
- /*! \brief Assignment from BufferGL - performs shallow copy.
- *
- * See Memory for further details.
- */
- BufferRenderGL& operator = (const BufferRenderGL& rhs)
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL& operator = (const BufferGL &buf)
{
- if (this != &rhs) {
- Buffer::operator=(rhs);
- }
+ Buffer::operator=(buf);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
- */
- BufferRenderGL& operator = (const cl_mem& rhs)
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL(BufferGL&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferGL& operator = (BufferGL &&buf)
{
- Buffer::operator=(rhs);
+ Buffer::operator=(std::move(buf));
return *this;
}
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
//! \brief Wrapper for clGetGLObjectInfo().
cl_int getObjectInfo(
cl_gl_object_type *type,
- GLuint * gl_object_name)
+ cl_GLuint * gl_object_name)
{
return detail::errHandler(
::clGetGLObjectInfo(object_,type,gl_object_name),
@@ -3488,40 +3524,52 @@ protected:
//! \brief Default constructor - initializes to NULL.
Image() : Memory() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- Image(const Image& image) : Memory(image) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS Image(const cl_mem& image) : Memory(image) { }
- /*! \brief Assignment from Image - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- Image& operator = (const Image& rhs)
+ Image& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Memory::operator=(rhs);
- }
+ Memory::operator=(rhs);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Image& operator = (const cl_mem& rhs)
+ Image(const Image& img) : Memory(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image& operator = (const Image &img)
{
- Memory::operator=(rhs);
+ Memory::operator=(img);
return *this;
}
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image(Image&& img) CL_HPP_NOEXCEPT : Memory(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image& operator = (Image &&img)
+ {
+ Memory::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
public:
//! \brief Wrapper for clGetImageInfo().
template <typename T>
@@ -3593,39 +3641,51 @@ public:
//! \brief Default constructor - initializes to NULL.
Image1D() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- Image1D(const Image1D& image1D) : Image(image1D) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS Image1D(const cl_mem& image1D) : Image(image1D) { }
- /*! \brief Assignment from Image1D - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- Image1D& operator = (const Image1D& rhs)
+ Image1D& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image::operator=(rhs);
- }
+ Image::operator=(rhs);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Image1D& operator = (const cl_mem& rhs)
+ Image1D(const Image1D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D& operator = (const Image1D &img)
{
- Image::operator=(rhs);
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D(Image1D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1D& operator = (Image1D &&img)
+ {
+ Image::operator=(std::move(img));
return *this;
}
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
/*! \class Image1DBuffer
@@ -3666,23 +3726,43 @@ public:
Image1DBuffer() { }
- Image1DBuffer(const Image1DBuffer& image1D) : Image(image1D) { }
-
__CL_EXPLICIT_CONSTRUCTORS Image1DBuffer(const cl_mem& image1D) : Image(image1D) { }
- Image1DBuffer& operator = (const Image1DBuffer& rhs)
+ Image1DBuffer& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image::operator=(rhs);
- }
+ Image::operator=(rhs);
return *this;
}
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer(const Image1DBuffer& img) : Image(img) {}
- Image1DBuffer& operator = (const cl_mem& rhs)
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer& operator = (const Image1DBuffer &img)
{
- Image::operator=(rhs);
+ Image::operator=(img);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer(Image1DBuffer&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DBuffer& operator = (Image1DBuffer &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
/*! \class Image1DArray
@@ -3727,23 +3807,43 @@ public:
Image1DArray() { }
- Image1DArray(const Image1DArray& imageArray) : Image(imageArray) { }
-
__CL_EXPLICIT_CONSTRUCTORS Image1DArray(const cl_mem& imageArray) : Image(imageArray) { }
- Image1DArray& operator = (const Image1DArray& rhs)
+ Image1DArray& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image::operator=(rhs);
- }
+ Image::operator=(rhs);
return *this;
}
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray(const Image1DArray& img) : Image(img) {}
- Image1DArray& operator = (const cl_mem& rhs)
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray& operator = (const Image1DArray &img)
{
- Image::operator=(rhs);
+ Image::operator=(img);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray(Image1DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image1DArray& operator = (Image1DArray &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
#endif // #if defined(CL_VERSION_1_2)
@@ -3829,39 +3929,51 @@ public:
//! \brief Default constructor - initializes to NULL.
Image2D() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- Image2D(const Image2D& image2D) : Image(image2D) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS Image2D(const cl_mem& image2D) : Image(image2D) { }
- /*! \brief Assignment from Image2D - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- Image2D& operator = (const Image2D& rhs)
+ Image2D& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image::operator=(rhs);
- }
+ Image::operator=(rhs);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Image2D& operator = (const cl_mem& rhs)
+ Image2D(const Image2D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D& operator = (const Image2D &img)
{
- Image::operator=(rhs);
+ Image::operator=(img);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D(Image2D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2D& operator = (Image2D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
@@ -3886,9 +3998,9 @@ public:
Image2DGL(
const Context& context,
cl_mem_flags flags,
- GLenum target,
- GLint miplevel,
- GLuint texobj,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
cl_int * err = NULL)
{
cl_int error;
@@ -3910,39 +4022,51 @@ public:
//! \brief Default constructor - initializes to NULL.
Image2DGL() : Image2D() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- Image2DGL(const Image2DGL& image) : Image2D(image) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS Image2DGL(const cl_mem& image) : Image2D(image) { }
- /*! \brief Assignment from Image2DGL - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- Image2DGL& operator = (const Image2DGL& rhs)
+ Image2DGL& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image2D::operator=(rhs);
- }
+ Image2D::operator=(rhs);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Image2DGL& operator = (const cl_mem& rhs)
+ Image2DGL(const Image2DGL& img) : Image2D(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL& operator = (const Image2DGL &img)
{
- Image2D::operator=(rhs);
+ Image2D::operator=(img);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL(Image2DGL&& img) CL_HPP_NOEXCEPT : Image2D(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DGL& operator = (Image2DGL &&img)
+ {
+ Image2D::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
#endif // #if !defined(CL_VERSION_1_2)
@@ -3993,23 +4117,43 @@ public:
Image2DArray() { }
- Image2DArray(const Image2DArray& imageArray) : Image(imageArray) { }
-
__CL_EXPLICIT_CONSTRUCTORS Image2DArray(const cl_mem& imageArray) : Image(imageArray) { }
- Image2DArray& operator = (const Image2DArray& rhs)
+ Image2DArray& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image::operator=(rhs);
- }
+ Image::operator=(rhs);
return *this;
}
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray(const Image2DArray& img) : Image(img) {}
- Image2DArray& operator = (const cl_mem& rhs)
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray& operator = (const Image2DArray &img)
{
- Image::operator=(rhs);
+ Image::operator=(img);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray(Image2DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image2DArray& operator = (Image2DArray &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
#endif // #if defined(CL_VERSION_1_2)
@@ -4097,13 +4241,7 @@ public:
}
//! \brief Default constructor - initializes to NULL.
- Image3D() { }
-
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- Image3D(const Image3D& image3D) : Image(image3D) { }
+ Image3D() : Image() { }
/*! \brief Constructor from cl_mem - takes ownership.
*
@@ -4111,27 +4249,45 @@ public:
*/
__CL_EXPLICIT_CONSTRUCTORS Image3D(const cl_mem& image3D) : Image(image3D) { }
- /*! \brief Assignment from Image3D - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- Image3D& operator = (const Image3D& rhs)
+ Image3D& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image::operator=(rhs);
- }
+ Image::operator=(rhs);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Image3D& operator = (const cl_mem& rhs)
+ Image3D(const Image3D& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D& operator = (const Image3D &img)
{
- Image::operator=(rhs);
+ Image::operator=(img);
return *this;
}
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D(Image3D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3D& operator = (Image3D &&img)
+ {
+ Image::operator=(std::move(img));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
#if !defined(CL_VERSION_1_2)
@@ -4154,9 +4310,9 @@ public:
Image3DGL(
const Context& context,
cl_mem_flags flags,
- GLenum target,
- GLint miplevel,
- GLuint texobj,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
cl_int * err = NULL)
{
cl_int error;
@@ -4177,39 +4333,51 @@ public:
//! \brief Default constructor - initializes to NULL.
Image3DGL() : Image3D() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * See Memory for further details.
- */
- Image3DGL(const Image3DGL& image) : Image3D(image) { }
-
/*! \brief Constructor from cl_mem - takes ownership.
*
* See Memory for further details.
*/
__CL_EXPLICIT_CONSTRUCTORS Image3DGL(const cl_mem& image) : Image3D(image) { }
- /*! \brief Assignment from Image3DGL - performs shallow copy.
+ /*! \brief Assignment from cl_mem - performs shallow copy.
*
* See Memory for further details.
*/
- Image3DGL& operator = (const Image3DGL& rhs)
+ Image3DGL& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image3D::operator=(rhs);
- }
+ Image3D::operator=(rhs);
return *this;
}
- /*! \brief Assignment from cl_mem - performs shallow copy.
- *
- * See Memory for further details.
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
*/
- Image3DGL& operator = (const cl_mem& rhs)
+ Image3DGL(const Image3DGL& img) : Image3D(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL& operator = (const Image3DGL &img)
{
- Image3D::operator=(rhs);
+ Image3D::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL(Image3DGL&& img) CL_HPP_NOEXCEPT : Image3D(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Image3DGL& operator = (Image3DGL &&img)
+ {
+ Image3D::operator=(std::move(img));
return *this;
}
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
#endif // #if !defined(CL_VERSION_1_2)
@@ -4226,9 +4394,9 @@ public:
ImageGL(
const Context& context,
cl_mem_flags flags,
- GLenum target,
- GLint miplevel,
- GLuint texobj,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texobj,
cl_int * err = NULL)
{
cl_int error;
@@ -4248,26 +4416,178 @@ public:
ImageGL() : Image() { }
- ImageGL(const ImageGL& image) : Image(image) { }
-
__CL_EXPLICIT_CONSTRUCTORS ImageGL(const cl_mem& image) : Image(image) { }
- ImageGL& operator = (const ImageGL& rhs)
+ ImageGL& operator = (const cl_mem& rhs)
{
- if (this != &rhs) {
- Image::operator=(rhs);
- }
+ Image::operator=(rhs);
return *this;
}
- ImageGL& operator = (const cl_mem& rhs)
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL(const ImageGL& img) : Image(img) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL& operator = (const ImageGL &img)
{
- Image::operator=(rhs);
+ Image::operator=(img);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL(ImageGL&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ ImageGL& operator = (ImageGL &&img)
+ {
+ Image::operator=(std::move(img));
return *this;
}
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
};
#endif // #if defined(CL_VERSION_1_2)
+/*! \brief Class interface for GL Render Buffer Memory Objects.
+*
+* This is provided to facilitate interoperability with OpenGL.
+*
+* See Memory for details about copy semantics, etc.
+*
+* \see Memory
+*/
+class BufferRenderGL :
+#if defined(CL_VERSION_1_2)
+ public ImageGL
+#else // #if defined(CL_VERSION_1_2)
+ public Image2DGL
+#endif //#if defined(CL_VERSION_1_2)
+{
+public:
+ /*! \brief Constructs a BufferRenderGL in a specified context, from a given
+ * GL Renderbuffer.
+ *
+ * Wraps clCreateFromGLRenderbuffer().
+ */
+ BufferRenderGL(
+ const Context& context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLRenderbuffer(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ //! \brief Default constructor - initializes to NULL.
+#if defined(CL_VERSION_1_2)
+ BufferRenderGL() : ImageGL() {};
+#else // #if defined(CL_VERSION_1_2)
+ BufferRenderGL() : Image2DGL() {};
+#endif //#if defined(CL_VERSION_1_2)
+
+ /*! \brief Constructor from cl_mem - takes ownership.
+ *
+ * See Memory for further details.
+ */
+#if defined(CL_VERSION_1_2)
+ __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : ImageGL(buffer) { }
+#else // #if defined(CL_VERSION_1_2)
+ __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : Image2DGL(buffer) { }
+#endif //#if defined(CL_VERSION_1_2)
+
+
+ /*! \brief Assignment from cl_mem - performs shallow copy.
+ *
+ * See Memory for further details.
+ */
+ BufferRenderGL& operator = (const cl_mem& rhs)
+ {
+#if defined(CL_VERSION_1_2)
+ ImageGL::operator=(rhs);
+#else // #if defined(CL_VERSION_1_2)
+ Image2DGL::operator=(rhs);
+#endif //#if defined(CL_VERSION_1_2)
+
+ return *this;
+ }
+
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+#if defined(CL_VERSION_1_2)
+ BufferRenderGL(const BufferRenderGL& buf) : ImageGL(buf) {}
+#else // #if defined(CL_VERSION_1_2)
+ BufferRenderGL(const BufferRenderGL& buf) : Image2DGL(buf) {}
+#endif //#if defined(CL_VERSION_1_2)
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL& operator = (const BufferRenderGL &rhs)
+ {
+#if defined(CL_VERSION_1_2)
+ ImageGL::operator=(rhs);
+#else // #if defined(CL_VERSION_1_2)
+ Image2DGL::operator=(rhs);
+#endif //#if defined(CL_VERSION_1_2)
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+#if defined(CL_VERSION_1_2)
+ BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : ImageGL(std::move(buf)) {}
+#else // #if defined(CL_VERSION_1_2)
+ BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : Image2DGL(std::move(buf)) {}
+#endif //#if defined(CL_VERSION_1_2)
+
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ BufferRenderGL& operator = (BufferRenderGL &&buf)
+ {
+#if defined(CL_VERSION_1_2)
+ ImageGL::operator=(std::move(buf));
+#else // #if defined(CL_VERSION_1_2)
+ Image2DGL::operator=(std::move(buf));
+#endif //#if defined(CL_VERSION_1_2)
+
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
+ //! \brief Wrapper for clGetGLObjectInfo().
+ cl_int getObjectInfo(
+ cl_gl_object_type *type,
+ cl_GLuint * gl_object_name)
+ {
+ return detail::errHandler(
+ ::clGetGLObjectInfo(object_, type, gl_object_name),
+ __GET_GL_OBJECT_INFO_ERR);
+ }
+};
+
/*! \brief Class interface for cl_sampler.
*
* \note Copies of these objects are shallow, meaning that the copy will refer
@@ -4279,12 +4599,6 @@ public:
class Sampler : public detail::Wrapper<cl_sampler>
{
public:
- /*! \brief Destructor.
- *
- * This calls clReleaseSampler() on the value held by this instance.
- */
- ~Sampler() { }
-
//! \brief Default constructor - initializes to NULL.
Sampler() { }
@@ -4313,31 +4627,12 @@ public:
}
}
- /*! \brief Copy constructor - performs shallow copy.
- *
- * This calls clRetainSampler() on the parameter's cl_sampler.
- */
- Sampler(const Sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
-
/*! \brief Constructor from cl_sampler - takes ownership.
*
* This effectively transfers ownership of a refcount on the cl_sampler
* into the new Sampler object.
*/
- Sampler(const cl_sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
-
- /*! \brief Assignment operator from Sampler.
- *
- * This calls clRetainSampler() on the parameter and clReleaseSampler()
- * on the previous value held by this instance.
- */
- Sampler& operator = (const Sampler& rhs)
- {
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
- return *this;
- }
+ __CL_EXPLICIT_CONSTRUCTORS Sampler(const cl_sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
/*! \brief Assignment operator from cl_sampler - takes ownership.
*
@@ -4350,6 +4645,36 @@ public:
return *this;
}
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler(const Sampler& sam) : detail::Wrapper<cl_type>(sam) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler& operator = (const Sampler &sam)
+ {
+ detail::Wrapper<cl_type>::operator=(sam);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler(Sampler&& sam) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(sam)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Sampler& operator = (Sampler &&sam)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(sam));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
//! \brief Wrapper for clGetSamplerInfo().
template <typename T>
cl_int getInfo(cl_sampler_info name, T* param) const
@@ -4442,14 +4767,14 @@ template <typename T>
struct KernelArgumentHandler
{
static ::size_t size(const T&) { return sizeof(T); }
- static T* ptr(T& value) { return &value; }
+ static const T* ptr(const T& value) { return &value; }
};
template <>
struct KernelArgumentHandler<LocalSpaceArg>
{
static ::size_t size(const LocalSpaceArg& value) { return value.size_; }
- static void* ptr(LocalSpaceArg&) { return NULL; }
+ static const void* ptr(const LocalSpaceArg&) { return NULL; }
};
}
@@ -4493,21 +4818,9 @@ class Kernel : public detail::Wrapper<cl_kernel>
public:
inline Kernel(const Program& program, const char* name, cl_int* err = NULL);
- /*! \brief Destructor.
- *
- * This calls clReleaseKernel() on the value held by this instance.
- */
- ~Kernel() { }
-
//! \brief Default constructor - initializes to NULL.
Kernel() { }
- /*! \brief Copy constructor - performs shallow copy.
- *
- * This calls clRetainKernel() on the parameter's cl_kernel.
- */
- Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
-
/*! \brief Constructor from cl_kernel - takes ownership.
*
* This effectively transfers ownership of a refcount on the cl_kernel
@@ -4515,19 +4828,6 @@ public:
*/
__CL_EXPLICIT_CONSTRUCTORS Kernel(const cl_kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
- /*! \brief Assignment operator from Kernel.
- *
- * This calls clRetainKernel() on the parameter and clReleaseKernel()
- * on the previous value held by this instance.
- */
- Kernel& operator = (const Kernel& rhs)
- {
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
- return *this;
- }
-
/*! \brief Assignment operator from cl_kernel - takes ownership.
*
* This effectively transfers ownership of a refcount on the rhs and calls
@@ -4539,6 +4839,36 @@ public:
return *this;
}
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel& operator = (const Kernel &kernel)
+ {
+ detail::Wrapper<cl_type>::operator=(kernel);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel(Kernel&& kernel) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(kernel)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Kernel& operator = (Kernel &&kernel)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(kernel));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
template <typename T>
cl_int getInfo(cl_kernel_info name, T* param) const
{
@@ -4607,7 +4937,7 @@ public:
}
template <typename T>
- cl_int setArg(cl_uint index, T value)
+ cl_int setArg(cl_uint index, const T &value)
{
return detail::errHandler(
::clSetKernelArg(
@@ -4618,7 +4948,7 @@ public:
__SET_KERNEL_ARGS_ERR);
}
- cl_int setArg(cl_uint index, ::size_t size, void* argPtr)
+ cl_int setArg(cl_uint index, ::size_t size, const void* argPtr)
{
return detail::errHandler(
::clSetKernelArg(object_, index, size, argPtr),
@@ -4637,7 +4967,7 @@ public:
Program(
const STRING_CLASS& source,
- bool build = false,
+ bool build = false,
cl_int* err = NULL)
{
cl_int error;
@@ -4789,7 +5119,7 @@ public:
object_ = ::clCreateProgramWithBinary(
context(), (cl_uint) devices.size(),
deviceIDs,
- lengths, images, binaryStatus != NULL
+ lengths, images, (binaryStatus != NULL && numDevices > 0)
? &binaryStatus->front()
: NULL, &error);
@@ -4836,23 +5166,43 @@ public:
Program() { }
- Program(const Program& program) : detail::Wrapper<cl_type>(program) { }
-
__CL_EXPLICIT_CONSTRUCTORS Program(const cl_program& program) : detail::Wrapper<cl_type>(program) { }
- Program& operator = (const Program& rhs)
+ Program& operator = (const cl_program& rhs)
{
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
+ detail::Wrapper<cl_type>::operator=(rhs);
return *this;
}
- Program& operator = (const cl_program& rhs)
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program(const Program& program) : detail::Wrapper<cl_type>(program) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program& operator = (const Program &program)
{
- detail::Wrapper<cl_type>::operator=(rhs);
+ detail::Wrapper<cl_type>::operator=(program);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program(Program&& program) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(program)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ Program& operator = (Program &&program)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(program));
return *this;
}
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
cl_int build(
const VECTOR_CLASS<Device>& devices,
@@ -4895,7 +5245,7 @@ public:
}
#if defined(CL_VERSION_1_2)
- cl_int compile(
+ cl_int compile(
const char* options = NULL,
void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
void* data = NULL) const
@@ -4906,9 +5256,9 @@ public:
0,
NULL,
options,
- 0,
- NULL,
- NULL,
+ 0,
+ NULL,
+ NULL,
notifyFptr,
data),
__COMPILE_PROGRAM_ERR);
@@ -4988,11 +5338,14 @@ inline Program linkProgram(
void* data = NULL,
cl_int* err = NULL)
{
- cl_int err_local = CL_SUCCESS;
+ cl_int error_local = CL_SUCCESS;
cl_program programs[2] = { input1(), input2() };
- Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>();
+ Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>(&error_local);
+ if(error_local!=CL_SUCCESS) {
+ detail::errHandler(error_local, __LINK_PROGRAM_ERR);
+ }
cl_program prog = ::clLinkProgram(
ctx(),
@@ -5003,11 +5356,11 @@ inline Program linkProgram(
programs,
notifyFptr,
data,
- &err_local);
+ &error_local);
- detail::errHandler(err_local,__COMPILE_PROGRAM_ERR);
+ detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
if (err != NULL) {
- *err = err_local;
+ *err = error_local;
}
return Program(prog);
@@ -5020,7 +5373,7 @@ inline Program linkProgram(
void* data = NULL,
cl_int* err = NULL)
{
- cl_int err_local = CL_SUCCESS;
+ cl_int error_local = CL_SUCCESS;
cl_program * programs = (cl_program*) alloca(inputPrograms.size() * sizeof(cl_program));
@@ -5030,8 +5383,15 @@ inline Program linkProgram(
}
}
+ Context ctx;
+ if(inputPrograms.size() > 0) {
+ ctx = inputPrograms[0].getInfo<CL_PROGRAM_CONTEXT>(&error_local);
+ if(error_local!=CL_SUCCESS) {
+ detail::errHandler(error_local, __LINK_PROGRAM_ERR);
+ }
+ }
cl_program prog = ::clLinkProgram(
- Context::getDefault()(),
+ ctx(),
0,
NULL,
options,
@@ -5039,11 +5399,11 @@ inline Program linkProgram(
programs,
notifyFptr,
data,
- &err_local);
+ &error_local);
- detail::errHandler(err_local,__COMPILE_PROGRAM_ERR);
+ detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
if (err != NULL) {
- *err = err_local;
+ *err = error_local;
}
return Program(prog);
@@ -5089,7 +5449,11 @@ inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
class CommandQueue : public detail::Wrapper<cl_command_queue>
{
private:
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+ static std::atomic<int> default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
static volatile int default_initialized_;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
static CommandQueue default_;
static volatile cl_int default_error_;
public:
@@ -5100,7 +5464,7 @@ public:
cl_int error;
Context context = Context::getDefault(&error);
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
if (error != CL_SUCCESS) {
if (err != NULL) {
@@ -5131,7 +5495,7 @@ public:
VECTOR_CLASS<cl::Device> devices;
error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ detail::errHandler(error, __CREATE_CONTEXT_ERR);
if (error != CL_SUCCESS)
{
@@ -5167,6 +5531,36 @@ public:
}
}
+ /*! \brief Copy constructor to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue(const CommandQueue& queue) : detail::Wrapper<cl_type>(queue) {}
+
+ /*! \brief Copy assignment to forward copy to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue& operator = (const CommandQueue &queue)
+ {
+ detail::Wrapper<cl_type>::operator=(queue);
+ return *this;
+ }
+
+#if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+ /*! \brief Move constructor to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue(CommandQueue&& queue) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(queue)) {}
+
+ /*! \brief Move assignment to forward move to the superclass correctly.
+ * Required for MSVC.
+ */
+ CommandQueue& operator = (CommandQueue &&queue)
+ {
+ detail::Wrapper<cl_type>::operator=(std::move(queue));
+ return *this;
+ }
+#endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
+
static CommandQueue getDefault(cl_int * err = NULL)
{
int state = detail::compare_exchange(
@@ -5230,17 +5624,7 @@ public:
CommandQueue() { }
- CommandQueue(const CommandQueue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
-
- CommandQueue(const cl_command_queue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
-
- CommandQueue& operator = (const CommandQueue& rhs)
- {
- if (this != &rhs) {
- detail::Wrapper<cl_type>::operator=(rhs);
- }
- return *this;
- }
+ __CL_EXPLICIT_CONSTRUCTORS CommandQueue(const cl_command_queue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
CommandQueue& operator = (const cl_command_queue& rhs)
{
@@ -5739,18 +6123,22 @@ public:
Event* event = NULL,
cl_int* err = NULL) const
{
+ cl_event tmp;
cl_int error;
void * result = ::clEnqueueMapBuffer(
object_, buffer(), blocking, flags, offset, size,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
- (cl_event*) event,
+ (event != NULL) ? &tmp : NULL,
&error);
detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
if (err != NULL) {
*err = error;
}
+ if (event != NULL && error == CL_SUCCESS)
+ *event = tmp;
+
return result;
}
@@ -5766,6 +6154,7 @@ public:
Event* event = NULL,
cl_int* err = NULL) const
{
+ cl_event tmp;
cl_int error;
void * result = ::clEnqueueMapImage(
object_, buffer(), blocking, flags,
@@ -5773,13 +6162,15 @@ public:
row_pitch, slice_pitch,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
- (cl_event*) event,
+ (event != NULL) ? &tmp : NULL,
&error);
detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
if (err != NULL) {
*err = error;
}
+ if (event != NULL && error == CL_SUCCESS)
+ *event = tmp;
return result;
}
@@ -5972,7 +6363,7 @@ public:
object_, userFptr, args.first, args.second,
(mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
mems,
- (mem_locs != NULL) ? (const void **) &mem_locs->front() : NULL,
+ (mem_locs != NULL && mem_locs->size() > 0) ? (const void **) &mem_locs->front() : NULL,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
(event != NULL) ? &tmp : NULL),
@@ -5991,9 +6382,17 @@ public:
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
cl_int enqueueMarker(Event* event = NULL) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
{
- return detail::errHandler(
- ::clEnqueueMarker(object_, (cl_event*) event),
+ cl_event tmp;
+ cl_int err = detail::errHandler(
+ ::clEnqueueMarker(
+ object_,
+ (event != NULL) ? &tmp : NULL),
__ENQUEUE_MARKER_ERR);
+
+ if (event != NULL && err == CL_SUCCESS)
+ *event = tmp;
+
+ return err;
}
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
@@ -6003,7 +6402,7 @@ public:
::clEnqueueWaitForEvents(
object_,
(cl_uint) events.size(),
- (const cl_event*) &events.front()),
+ events.size() > 0 ? (const cl_event*) &events.front() : NULL),
__ENQUEUE_WAIT_FOR_EVENTS_ERR);
}
#endif // #if defined(CL_VERSION_1_1)
@@ -6018,7 +6417,7 @@ public:
::clEnqueueAcquireGLObjects(
object_,
(mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
- (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
(event != NULL) ? &tmp : NULL),
@@ -6040,7 +6439,7 @@ public:
::clEnqueueReleaseGLObjects(
object_,
(mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
- (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
(event != NULL) ? &tmp : NULL),
@@ -6083,7 +6482,7 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
pfn_clEnqueueAcquireD3D10ObjectsKHR(
object_,
(mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
- (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
(events != NULL) ? (cl_uint) events->size() : 0,
(events != NULL) ? (cl_event*) &events->front() : NULL,
(event != NULL) ? &tmp : NULL),
@@ -6116,9 +6515,9 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
pfn_clEnqueueReleaseD3D10ObjectsKHR(
object_,
(mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
- (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
(events != NULL) ? (cl_uint) events->size() : 0,
- (events != NULL) ? (cl_event*) &events->front() : NULL,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
(event != NULL) ? &tmp : NULL),
__ENQUEUE_RELEASE_GL_ERR);
@@ -6154,14 +6553,22 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
};
#ifdef _WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__declspec(selectany) std::atomic<int> CommandQueue::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__declspec(selectany) volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__declspec(selectany) CommandQueue CommandQueue::default_;
__declspec(selectany) volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
-#else
+#else // !_WIN32
+#ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
+__attribute__((weak)) std::atomic<int> CommandQueue::default_initialized_;
+#else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__attribute__((weak)) volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
+#endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
__attribute__((weak)) CommandQueue CommandQueue::default_;
__attribute__((weak)) volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
-#endif
+#endif // !_WIN32
template< typename IteratorType >
Buffer::Buffer(
@@ -6214,6 +6621,54 @@ Buffer::Buffer(
}
}
+template< typename IteratorType >
+Buffer::Buffer(
+ const CommandQueue &queue,
+ IteratorType startIterator,
+ IteratorType endIterator,
+ bool readOnly,
+ bool useHostPtr,
+ cl_int* err)
+{
+ typedef typename std::iterator_traits<IteratorType>::value_type DataType;
+ cl_int error;
+
+ cl_mem_flags flags = 0;
+ if (readOnly) {
+ flags |= CL_MEM_READ_ONLY;
+ }
+ else {
+ flags |= CL_MEM_READ_WRITE;
+ }
+ if (useHostPtr) {
+ flags |= CL_MEM_USE_HOST_PTR;
+ }
+
+ ::size_t size = sizeof(DataType)*(endIterator - startIterator);
+
+ Context context = queue.getInfo<CL_QUEUE_CONTEXT>();
+
+ if (useHostPtr) {
+ object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
+ }
+ else {
+ object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
+ }
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ if (!useHostPtr) {
+ error = cl::copy(queue, startIterator, endIterator, *this);
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+}
+
inline cl_int enqueueReadBuffer(
const Buffer& buffer,
cl_bool blocking,
@@ -12308,8 +12763,8 @@ struct make_kernel :
>
{
public:
- typedef detail::KernelFunctorGlobal<
- T0, T1, T2, T3,
+ typedef detail::KernelFunctorGlobal<
+ T0, T1, T2, T3,
T4, T5, T6, T7,
T8, T9, T10, T11,
T12, T13, T14, T15,
@@ -12443,10 +12898,9 @@ public:
#undef __DEFAULT_BEING_INITIALIZED
#undef __DEFAULT_INITIALIZED
-} // namespace cl
+#undef CL_HPP_RVALUE_REFERENCES_SUPPORTED
+#undef CL_HPP_NOEXCEPT
-#ifdef _WIN32
-#pragma pop_macro("max")
-#endif // _WIN32
+} // namespace cl
#endif // CL_HPP_
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp
index 18133256a..d3f0e9611 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash-cl/ethash_cl_miner.cpp
@@ -250,11 +250,10 @@ void ethash_cl_miner::search(uint8_t const* header, uint64_t target, search_hook
m_queue.enqueueBarrierWithWaitList(NULL, &pre_return_event);
}
else
-#else
+#endif
{
m_queue.finish();
}
-#endif
/*
__kernel void ethash_combined_search(
diff --git a/blockpool/blockpool.go b/blockpool/blockpool.go
index 1ca97e0ca..d9f8e3baa 100644
--- a/blockpool/blockpool.go
+++ b/blockpool/blockpool.go
@@ -238,12 +238,17 @@ func (self *BlockPool) Start() {
case event := <-self.tdSub.Chan():
if ev, ok := event.(core.ChainHeadEvent); ok {
td := ev.Block.Td
- plog.DebugDetailf("td: %v", td)
+ var height *big.Int
+ if (ev.Block.HeaderHash == common.Hash{}) {
+ height = ev.Block.Header().Number
+ }
+ plog.DebugDetailf("ChainHeadEvent: height: %v, td: %v, hash: %s", height, td, hex(ev.Block.Hash()))
self.setTD(td)
self.peers.lock.Lock()
if best := self.peers.best; best != nil {
- if td.Cmp(best.td) >= 0 {
+ // only switch if we strictly go above otherwise we may stall if only
+ if td.Cmp(best.td) > 0 {
self.peers.best = nil
self.switchPeer(best, nil)
}
@@ -706,7 +711,7 @@ func (self *BlockPool) AddBlock(block *types.Block, peerId string) {
It activates the section process on incomplete sections with peer.
It relinks orphaned sections with their parent if root block (and its parent hash) is known.
*/
-func (self *BlockPool) activateChain(sec *section, p *peer, connected map[string]*section) {
+func (self *BlockPool) activateChain(sec *section, p *peer, connected map[common.Hash]*section) {
p.lock.RLock()
switchC := p.switchC
@@ -720,7 +725,7 @@ LOOP:
plog.DebugDetailf("activateChain: section [%s] activated by peer <%s>", sectionhex(sec), p.id)
sec.activate(p)
if i > 0 && connected != nil {
- connected[sec.top.hash.Str()] = sec
+ connected[sec.top.hash] = sec
}
/*
Need to relink both complete and incomplete sections
diff --git a/blockpool/peers.go b/blockpool/peers.go
index 1e56f315d..615058e26 100644
--- a/blockpool/peers.go
+++ b/blockpool/peers.go
@@ -356,16 +356,16 @@ func (self *BlockPool) switchPeer(oldp, newp *peer) {
}
- var connected = make(map[string]*section)
+ var connected = make(map[common.Hash]*section)
var sections []common.Hash
for _, hash := range newp.sections {
plog.DebugDetailf("activate chain starting from section [%s]", hex(hash))
// if section not connected (ie, top of a contiguous sequence of sections)
- if connected[hash.Str()] == nil {
+ if connected[hash] == nil {
// if not deleted, then reread from pool (it can be orphaned top half of a split section)
if entry := self.get(hash); entry != nil {
self.activateChain(entry.section, newp, connected)
- connected[hash.Str()] = entry.section
+ connected[hash] = entry.section
sections = append(sections, hash)
}
}
@@ -531,6 +531,7 @@ func (self *peer) run() {
self.blocksRequestTimer = time.After(0)
self.headInfoTimer = time.After(self.bp.Config.BlockHashesTimeout)
+ self.bestIdleTimer = nil
var ping = time.NewTicker(5 * time.Second)
@@ -581,7 +582,7 @@ LOOP:
case <-self.bp.quit:
break LOOP
- // quit
+ // best
case <-self.bestIdleTimer:
self.peerError(self.bp.peers.errors.New(ErrIdleTooLong, "timed out without providing new blocks (td: %v, head: %s)...quitting", self.td, hex(self.currentBlockHash)))
diff --git a/blockpool/peers_test.go b/blockpool/peers_test.go
index beeb0ad1d..62e059337 100644
--- a/blockpool/peers_test.go
+++ b/blockpool/peers_test.go
@@ -14,7 +14,7 @@ import (
// the actual tests
func TestAddPeer(t *testing.T) {
test.LogInit()
- _, blockPool, blockPoolTester := newTestBlockPool(t)
+ hashPool, blockPool, blockPoolTester := newTestBlockPool(t)
peer0 := blockPoolTester.newPeer("peer0", 1, 1)
peer1 := blockPoolTester.newPeer("peer1", 2, 2)
peer2 := blockPoolTester.newPeer("peer2", 3, 3)
@@ -119,7 +119,8 @@ func TestAddPeer(t *testing.T) {
}
peer0.waitBlocksRequests(3)
- newblock := &types.Block{Td: common.Big3}
+ hash := hashPool.IndexesToHashes([]int{0})[0]
+ newblock := &types.Block{Td: common.Big3, HeaderHash: hash}
blockPool.chainEvents.Post(core.ChainHeadEvent{newblock})
time.Sleep(100 * time.Millisecond)
if blockPool.peers.best != nil {
diff --git a/cmd/ethereum/js.go b/cmd/ethereum/js.go
index 6f0ac526f..1f0033daa 100644
--- a/cmd/ethereum/js.go
+++ b/cmd/ethereum/js.go
@@ -31,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/xeth"
"github.com/peterh/liner"
+ "github.com/robertkrimen/otto"
)
type prompter interface {
@@ -101,8 +102,7 @@ func (js *jsre) apiBindings() {
jethObj := t.Object()
jethObj.Set("send", jeth.Send)
- _, err := js.re.Eval(re.BigNumber_JS)
-
+ err := js.re.Compile("bignum.js", re.BigNumber_JS)
if err != nil {
utils.Fatalf("Error loading bignumber.js: %v", err)
}
@@ -113,12 +113,12 @@ func (js *jsre) apiBindings() {
utils.Fatalf("Error defining setTimeout: %v", err)
}
- _, err = js.re.Eval(re.Ethereum_JS)
+ err = js.re.Compile("ethereum.js", re.Ethereum_JS)
if err != nil {
utils.Fatalf("Error loading ethereum.js: %v", err)
}
- _, err = js.re.Eval("var web3 = require('web3');")
+ _, err = js.re.Eval("var web3 = require('ethereum.js');")
if err != nil {
utils.Fatalf("Error requiring web3: %v", err)
}
@@ -128,10 +128,10 @@ func (js *jsre) apiBindings() {
utils.Fatalf("Error setting web3 provider: %v", err)
}
_, err = js.re.Eval(`
- var eth = web3.eth;
- var shh = web3.shh;
- var db = web3.db;
- var net = web3.net;
+var eth = web3.eth;
+var shh = web3.shh;
+var db = web3.db;
+var net = web3.net;
`)
if err != nil {
utils.Fatalf("Error setting namespaces: %v", err)
@@ -211,7 +211,11 @@ func (self *jsre) parseInput(code string) {
}()
value, err := self.re.Run(code)
if err != nil {
- fmt.Println(err)
+ if ottoErr, ok := err.(*otto.Error); ok {
+ fmt.Println(ottoErr.String())
+ } else {
+ fmt.Println(err)
+ }
return
}
self.printValue(value)
diff --git a/cmd/ethereum/js_test.go b/cmd/ethereum/js_test.go
index e3806d24d..a6058b318 100644
--- a/cmd/ethereum/js_test.go
+++ b/cmd/ethereum/js_test.go
@@ -2,11 +2,12 @@ package main
import (
"fmt"
- "github.com/robertkrimen/otto"
"os"
"path"
"testing"
+ "github.com/robertkrimen/otto"
+
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
@@ -141,10 +142,19 @@ func TestAccounts(t *testing.T) {
if err != nil {
t.Errorf("expected no error, got %v", err)
}
- addrs, ok := exp.([]string)
+ interfaceAddr, ok := exp.([]interface{})
if !ok {
- t.Errorf("expected []string, got %v", err)
+ t.Errorf("expected []string, got %T", exp)
}
+
+ addrs := make([]string, len(interfaceAddr))
+ for i, addr := range interfaceAddr {
+ var ok bool
+ if addrs[i], ok = addr.(string); !ok {
+ t.Errorf("expected addrs[%d] to be string. Got %T instead", i, addr)
+ }
+ }
+
if len(addrs) != 2 || (addr != addrs[0][2:] && addr != addrs[1][2:]) {
t.Errorf("expected addrs == [<default>, <new>], got %v (%v)", addrs, addr)
}
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 5ad4c0a4e..2cf81b9e7 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -33,16 +33,16 @@ import (
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/core/state"
"github.com/peterh/liner"
)
const (
ClientIdentifier = "Ethereum(G)"
- Version = "0.9.2"
+ Version = "0.9.3"
)
var (
diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html
index 96f2299a5..41362554d 100644
--- a/cmd/mist/assets/examples/coin.html
+++ b/cmd/mist/assets/examples/coin.html
@@ -32,7 +32,7 @@
</body>
<script type="text/javascript">
- var web3 = require('web3');
+ var web3 = require('ethereum.js');
var eth = web3.eth;
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
diff --git a/cmd/mist/assets/ext/ethereum.js b/cmd/mist/assets/ext/ethereum.js
-Subproject d5093606945fd871bc62f5d6adade3a903b0533
+Subproject 9f073d9091cd2d2b46dd46afea9dcf5d825ecd7
diff --git a/eth/backend.go b/eth/backend.go
index cf5bd2c92..c73e76792 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -168,13 +168,13 @@ func New(config *Config) (*Ethereum, error) {
extraDb, err := ethdb.NewLDBDatabase(path.Join(config.DataDir, "extra"))
// Perform database sanity checks
- d, _ := extraDb.Get([]byte("ProtocolVersion"))
+ d, _ := blockDb.Get([]byte("ProtocolVersion"))
protov := int(common.NewValue(d).Uint())
if protov != config.ProtocolVersion && protov != 0 {
path := path.Join(config.DataDir, "blockchain")
return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, config.ProtocolVersion, path)
}
- saveProtocolVersion(extraDb, config.ProtocolVersion)
+ saveProtocolVersion(blockDb, config.ProtocolVersion)
servlogger.Infof("Protocol Version: %v, Network Id: %v", config.ProtocolVersion, config.NetworkId)
eth := &Ethereum{
diff --git a/jsre/ethereum_js.go b/jsre/ethereum_js.go
index 8b2f6e9dd..fb0170288 100644
--- a/jsre/ethereum_js.go
+++ b/jsre/ethereum_js.go
@@ -1,3 +1,3 @@
package jsre
-const Ethereum_JS = `require=function t(e,n,r){function o(i,u){if(!n[i]){if(!e[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[i]={exports:{}};e[i][0].call(l.exports,function(t){var n=e[i][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(t,e){var n=t("../utils/utils"),r=t("../utils/config"),o=t("./types"),a=t("./formatters"),i=function(t){throw new Error("parser does not support type: "+t)},u=function(t){return"[]"===t.slice(-2)},s=function(t,e){return u(t)||"string"===t?a.formatInputInt(e.length):""},c=o.inputTypes(),l=function(t,e){var n="",r="",o="";return t.forEach(function(t,r){n+=s(t.type,e[r])}),t.forEach(function(n,a){for(var s=!1,l=0;l<c.length&&!s;l++)s=c[l].type(t[a].type,e[a]);s||i(t[a].type);var f=c[l-1].format;u(t[a].type)?o+=e[a].reduce(function(t,e){return t+f(e)},""):"string"===t[a].type?o+=f(e[a]):r+=f(e[a])}),n+=r+o},f=function(t){return u(t)||"string"===t?2*r.ETH_PADDING:0},p=o.outputTypes(),m=function(t,e){e=e.slice(2);var n=[],s=2*r.ETH_PADDING,c=t.reduce(function(t,e){return t+f(e.type)},0),l=e.slice(0,c);return e=e.slice(c),t.forEach(function(r,c){for(var f=!1,m=0;m<p.length&&!f;m++)f=p[m].type(t[c].type);f||i(t[c].type);var d=p[m-1].format;if(u(t[c].type)){var h=a.formatOutputUInt(l.slice(0,s));l=l.slice(s);for(var g=[],y=0;h>y;y++)g.push(d(e.slice(0,s))),e=e.slice(s);n.push(g)}else o.prefixedType("string")(t[c].type)?(l=l.slice(s),n.push(d(e.slice(0,s))),e=e.slice(s)):(n.push(d(e.slice(0,s))),e=e.slice(s))}),n},d=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),o=n.extractTypeName(t.name),a=function(){var e=Array.prototype.slice.call(arguments);return l(t.inputs,e)};void 0===e[r]&&(e[r]=a),e[r][o]=a}),e},h=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),o=n.extractTypeName(t.name),a=function(e){return m(t.outputs,e)};void 0===e[r]&&(e[r]=a),e[r][o]=a}),e};e.exports={inputParser:d,outputParser:h,formatInput:l,formatOutput:m}},{"../utils/config":4,"../utils/utils":5,"./formatters":2,"./types":3}],2:[function(t,e){var n=t("../utils/utils"),r=t("../utils/config"),o=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e=2*r.ETH_PADDING;return BigNumber.config(r.ETH_BIGNUMBER_ROUNDING_MODE),o(n.toTwosComplement(t).round().toString(16),e)},i=function(t){return n.fromAscii(t,r.ETH_PADDING).substr(2)},u=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},s=function(t){return a(new BigNumber(t).times(new BigNumber(2).pow(128)))},c=function(t){return"1"===new BigNumber(t.substr(0,1),16).toString(2).substr(0,1)},l=function(t){return t=t||"0",c(t)?new BigNumber(t,16).minus(new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new BigNumber(t,16)},f=function(t){return t=t||"0",new BigNumber(t,16)},p=function(t){return l(t).dividedBy(new BigNumber(2).pow(128))},m=function(t){return f(t).dividedBy(new BigNumber(2).pow(128))},d=function(t){return"0x"+t},h=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},g=function(t){return n.toAscii(t)},y=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:a,formatInputString:i,formatInputBool:u,formatInputReal:s,formatOutputInt:l,formatOutputUInt:f,formatOutputReal:p,formatOutputUReal:m,formatOutputHash:d,formatOutputBool:h,formatOutputString:g,formatOutputAddress:y}},{"../utils/config":4,"../utils/utils":5}],3:[function(t,e){var n=t("./formatters"),r=function(t){return function(e){return 0===e.indexOf(t)}},o=function(t){return function(e){return t===e}},a=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:o("address"),format:n.formatInputInt},{type:o("bool"),format:n.formatInputBool}]},i=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:o("address"),format:n.formatOutputAddress},{type:o("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:o,inputTypes:a,outputTypes:i}},{"./formatters":2}],4:[function(t,e){var n=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:n,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:BigNumber.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3,ETH_DEFAULTBLOCK:"latest"}},{}],5:[function(t,e){var n={wei:"1",kwei:"1000",ada:"1000",mwei:"1000000",babbage:"1000000",gwei:"1000000000",shannon:"1000000000",szabo:"1000000000000",finney:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},r=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},o=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);if(0===o)break;e+=String.fromCharCode(o)}return e},a=function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}return e},i=function(t,e){e=void 0===e?0:e;for(var n=a(t);n.length<2*e;)n+="00";return"0x"+n},u=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},s=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)).replace(" ",""):""},c=function(t){return t.filter(function(t){return"function"===t.type})},l=function(t){return t.filter(function(t){return"event"===t.type})},f=function(t){return y(t).toNumber()},p=function(t){var e=y(t),n=e.toString(16);return e.lessThan(0)?"-0x"+n.substr(1):"0x"+n},m=function(t){if(B(t))return t;if(w(t))return p(t);if(T(t))return i(JSON.stringify(t));if(_(t)){if(0===t.indexOf("-0x"))return p(t);if(!isFinite(t))return i(t)}return p(t)},d=function(t){t=t?t.toLowerCase():"ether";var e=n[t];if(void 0===e)throw new Error("This unit doesn't exists, please use the one of the following units"+JSON.stringify(n,null,2));return new BigNumber(e,10)},h=function(t,e){var n=y(t).dividedBy(d(e));return w(t)?n:n.toString(10)},g=function(t,e){var n=y(t).times(d(e));return w(t)?n:n.toString(10)},y=function(t){return t=t||0,w(t)?t:!_(t)||0!==t.indexOf("0x")&&0!==t.indexOf("-0x")?new BigNumber(t.toString(10),10):new BigNumber(t.replace("0x",""),16)},b=function(t){var e=y(t);return e.lessThan(0)?new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(e).plus(1):e},v=function(t){return _(t)?0===t.indexOf("0x")&&42===t.length||-1===t.indexOf("0x")&&40===t.length:!1},w=function(t){return t instanceof BigNumber||t&&t.constructor&&"BigNumber"===t.constructor.name},_=function(t){return"string"==typeof t||t&&t.constructor&&"String"===t.constructor.name},x=function(t){return"function"==typeof t},T=function(t){return"object"==typeof t},B=function(t){return"boolean"==typeof t},F=function(t){return t instanceof Array};e.exports={findIndex:r,toHex:m,toDecimal:f,fromDecimal:p,toAscii:o,fromAscii:i,extractDisplayName:u,extractTypeName:s,filterFunctions:c,filterEvents:l,toWei:g,fromWei:h,toBigNumber:y,toTwosComplement:b,isBigNumber:w,isAddress:v,isFunction:x,isString:_,isObject:T,isBoolean:B,isArray:F}},{}],6:[function(t,e){var n=t("./web3/net"),r=t("./web3/eth"),o=t("./web3/db"),a=t("./web3/shh"),i=t("./web3/watches"),u=t("./web3/filter"),s=t("./utils/utils"),c=t("./solidity/formatters"),l=t("./web3/requestmanager"),f=t("./utils/config"),p=function(){return[{name:"sha3",call:"web3_sha3"}]},m=function(t,e){e.forEach(function(e){var n=e.name.split("."),r=function(){var t=null,n=Array.prototype.slice.call(arguments),r="function"==typeof e.call?e.call(n):e.call;return"function"==typeof n[n.length-1]&&(t=n[n.length-1],Array.prototype.pop.call(n)),e.addDefaultblock&&(n.length!==e.addDefaultblock?Array.prototype.push.call(n,isFinite(f.ETH_DEFAULTBLOCK)?s.fromDecimal(f.ETH_DEFAULTBLOCK):f.ETH_DEFAULTBLOCK):n[n.length-1]=isFinite(n[n.length-1])?s.fromDecimal(n[n.length-1]):n[n.length-1]),e.newMethod&&console.warn("This method is deprecated please use web3."+e.newMethod+"() instead."),v.manager.send({method:r,params:n,outputFormatter:e.outputFormatter,inputFormatter:e.inputFormatter,addDefaultblock:e.addDefaultblock},t)};n.length>1?(t[n[0]]||(t[n[0]]={}),t[n[0]][n[1]]=r):t[n[0]]=r})},d=function(t,e){e.forEach(function(e){var n={};n.get=function(){return e.newProperty&&console.warn("This property is deprecated please use web3."+e.newProperty+" instead."),v.manager.send({method:e.getter,outputFormatter:e.outputFormatter})},e.setter&&(n.set=function(t){return e.newProperty&&console.warn("This property is deprecated please use web3."+e.newProperty+" instead."),v.manager.send({method:e.setter,params:[t],inputFormatter:e.inputFormatter})}),n.enumerable=!e.newProperty,Object.defineProperty(t,e.name,n)})},h=function(t,e,n,r){v.manager.startPolling({method:t,params:[e]},e,n,r)},g=function(t){v.manager.stopPolling(t)},y={startPolling:h.bind(null,"eth_getFilterChanges"),stopPolling:g},b={startPolling:h.bind(null,"shh_getFilterChanges"),stopPolling:g},v={manager:l(),providers:{},setProvider:function(t){v.manager.setProvider(t)},reset:function(){v.manager.reset()},toHex:s.toHex,toAscii:s.toAscii,fromAscii:s.fromAscii,toDecimal:s.toDecimal,fromDecimal:s.fromDecimal,toBigNumber:s.toBigNumber,toWei:s.toWei,fromWei:s.fromWei,isAddress:s.isAddress,net:{},eth:{contractFromAbi:function(t){return console.warn("Initiating a contract like this is deprecated please use var MyContract = eth.contract(abi); new MyContract(address); instead."),function(e){e=e||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";var n=v.eth.contract(e,t);return n.address=e,n}},filter:function(t,e,n){return t._isEvent?t(e,n):u(t,y,c.outputLogFormatter)},watch:function(t,e,n){return console.warn("eth.watch() is deprecated please use eth.filter() instead."),this.filter(t,e,n)}},db:{},shh:{filter:function(t){return u(t,b,c.outputPostFormatter)},watch:function(t){return console.warn("shh.watch() is deprecated please use shh.filter() instead."),this.filter(t)}}};Object.defineProperty(v.eth,"defaultBlock",{get:function(){return f.ETH_DEFAULTBLOCK},set:function(t){return f.ETH_DEFAULTBLOCK=t,f.ETH_DEFAULTBLOCK}}),m(v,p()),m(v.net,n.methods),d(v.net,n.properties),m(v.eth,r.methods),d(v.eth,r.properties),m(v.db,o.methods()),m(v.shh,a.methods()),m(y,i.eth()),m(b,i.shh()),e.exports=v},{"./solidity/formatters":2,"./utils/config":4,"./utils/utils":5,"./web3/db":8,"./web3/eth":9,"./web3/filter":11,"./web3/net":15,"./web3/requestmanager":17,"./web3/shh":18,"./web3/watches":20}],7:[function(t,e){function n(t,e){t.forEach(function(t){if(-1===t.name.indexOf("(")){var e=t.name,n=t.inputs.map(function(t){return t.type}).join();t.name=e+"("+n+")"}});var n={};return c(n),l(n,t,e),f(n,t,e),p(n,t,e),n}var r=t("../web3"),o=t("../solidity/abi"),a=t("../utils/utils"),i=t("./event"),u=t("./signature"),s=function(t){r._currentContractAbi=t.abi,r._currentContractAddress=t.address,r._currentContractMethodName=t.method,r._currentContractMethodParams=t.params},c=function(t){t.call=function(e){return t._isTransaction=!1,t._options=e,t},t.sendTransaction=function(e){return t._isTransaction=!0,t._options=e,t},t.transact=function(e){return console.warn("myContract.transact() is deprecated please use myContract.sendTransaction() instead."),t.sendTransaction(e)},t._options={},["gas","gasPrice","value","from"].forEach(function(e){t[e]=function(n){return t._options[e]=n,t}})},l=function(t,e,n){var i=o.inputParser(e),c=o.outputParser(e);a.filterFunctions(e).forEach(function(o){var l=a.extractDisplayName(o.name),f=a.extractTypeName(o.name),p=function(){var a=Array.prototype.slice.call(arguments),p=u.functionSignatureFromAscii(o.name),m=i[l][f].apply(null,a),d=t._options||{};d.to=n,d.data=p+m;var h=t._isTransaction===!0||t._isTransaction!==!1&&!o.constant,g=d.collapse!==!1;if(t._options={},t._isTransaction=null,h)return s({abi:e,address:n,method:o.name,params:a}),void r.eth.sendTransaction(d);var y=r.eth.call(d),b=c[l][f](y);return g&&(1===b.length?b=b[0]:0===b.length&&(b=null)),b};void 0===t[l]&&(t[l]=p),t[l][f]=p})},f=function(t,e,n){t.address=n,t._onWatchEventResult=function(t){var n=event.getMatchingEvent(a.filterEvents(e)),r=i.outputParser(n);return r(t)},Object.defineProperty(t,"topics",{get:function(){return a.filterEvents(e).map(function(t){return u.eventSignatureFromAscii(t.name)})}})},p=function(t,e,n){a.filterEvents(e).forEach(function(e){var o=function(){var t=Array.prototype.slice.call(arguments),o=u.eventSignatureFromAscii(e.name),a=i.inputParser(n,o,e),s=a.apply(null,t),c=function(t){var n=i.outputParser(e);return n(t)};return r.eth.filter(s,void 0,void 0,c)};o._isEvent=!0;var s=a.extractDisplayName(e.name),c=a.extractTypeName(e.name);void 0===t[s]&&(t[s]=o),t[s][c]=o})},m=function(t){return t instanceof Array&&1===arguments.length?n.bind(null,t):(console.warn("Initiating a contract like this is deprecated please use var MyContract = eth.contract(abi); new MyContract(address); instead."),new n(arguments[1],arguments[0]))};e.exports=m},{"../solidity/abi":1,"../utils/utils":5,"../web3":6,"./event":10,"./signature":19}],8:[function(t,e){var n=function(){return[{name:"put",call:"db_put"},{name:"get",call:"db_get"},{name:"putString",call:"db_putString"},{name:"getString",call:"db_getString"}]};e.exports={methods:n}},{}],9:[function(t,e){var n=t("./formatters"),r=t("../utils/utils"),o=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},a=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},i=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},u=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},s=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},c=[{name:"getBalance",call:"eth_getBalance",addDefaultblock:2,outputFormatter:n.convertToBigNumber},{name:"getStorage",call:"eth_getStorage",addDefaultblock:2},{name:"getStorageAt",call:"eth_getStorageAt",addDefaultblock:3,inputFormatter:r.toHex},{name:"getData",call:"eth_getData",addDefaultblock:2},{name:"getBlock",call:o,outputFormatter:n.outputBlockFormatter,inputFormatter:[r.toHex,function(t){return t?!0:!1}]},{name:"getUncle",call:i,outputFormatter:n.outputBlockFormatter,inputFormatter:[r.toHex,r.toHex,function(t){return t?!0:!1}]},{name:"getCompilers",call:"eth_getCompilers"},{name:"getBlockTransactionCount",call:u,outputFormatter:r.toDecimal,inputFormatter:r.toHex},{name:"getBlockUncleCount",call:s,outputFormatter:r.toDecimal,inputFormatter:r.toHex},{name:"getTransaction",call:"eth_getTransactionByHash",outputFormatter:n.outputTransactionFormatter},{name:"getTransactionFromBlock",call:a,outputFormatter:n.outputTransactionFormatter,inputFormatter:r.toHex},{name:"getTransactionCount",call:"eth_getTransactionCount",addDefaultblock:2,outputFormatter:r.toDecimal},{name:"sendTransaction",call:"eth_sendTransaction",inputFormatter:n.inputTransactionFormatter},{name:"call",call:"eth_call",addDefaultblock:2,inputFormatter:n.inputCallFormatter},{name:"compile.solidity",call:"eth_compileSolidity",inputFormatter:r.toHex},{name:"compile.lll",call:"eth_compileLLL",inputFormatter:r.toHex},{name:"compile.serpent",call:"eth_compileSerpent",inputFormatter:r.toHex},{name:"flush",call:"eth_flush"},{name:"balanceAt",call:"eth_balanceAt",newMethod:"eth.getBalance"},{name:"stateAt",call:"eth_stateAt",newMethod:"eth.getStorageAt"},{name:"storageAt",call:"eth_storageAt",newMethod:"eth.getStorage"},{name:"countAt",call:"eth_countAt",newMethod:"eth.getTransactionCount"},{name:"codeAt",call:"eth_codeAt",newMethod:"eth.getData"},{name:"transact",call:"eth_transact",newMethod:"eth.sendTransaction"},{name:"block",call:o,newMethod:"eth.getBlock"},{name:"transaction",call:a,newMethod:"eth.getTransaction"},{name:"uncle",call:i,newMethod:"eth.getUncle"},{name:"compilers",call:"eth_compilers",newMethod:"eth.getCompilers"},{name:"solidity",call:"eth_solidity",newMethod:"eth.compile.solidity"},{name:"lll",call:"eth_lll",newMethod:"eth.compile.lll"},{name:"serpent",call:"eth_serpent",newMethod:"eth.compile.serpent"},{name:"transactionCount",call:u,newMethod:"eth.getBlockTransactionCount"},{name:"uncleCount",call:s,newMethod:"eth.getBlockUncleCount"},{name:"logs",call:"eth_logs"}],l=[{name:"coinbase",getter:"eth_coinbase"},{name:"mining",getter:"eth_mining"},{name:"gasPrice",getter:"eth_gasPrice",outputFormatter:n.convertToBigNumber},{name:"accounts",getter:"eth_accounts"},{name:"blockNumber",getter:"eth_blockNumber",outputFormatter:r.toDecimal},{name:"listening",getter:"net_listening",setter:"eth_setListening",newProperty:"net.listening"},{name:"peerCount",getter:"net_peerCount",newProperty:"net.peerCount"},{name:"number",getter:"eth_number",newProperty:"eth.blockNumber"}];e.exports={methods:c,properties:l}},{"../utils/utils":5,"./formatters":12}],10:[function(t,e){var n=t("../solidity/abi"),r=t("../utils/utils"),o=t("./signature"),a=function(t,e){return t.filter(function(t){return t.indexed===e})},i=function(t,e){var n=r.findIndex(t,function(t){return t.name===e});return-1===n?void console.error("indexed param with name "+e+" not found"):t[n]},u=function(t,e){return Object.keys(e).map(function(r){var o=[i(a(t.inputs,!0),r)],u=e[r];return u instanceof Array?u.map(function(t){return n.formatInput(o,[t])}):n.formatInput(o,[u])})},s=function(t,e,n){return function(r,o){var a=o||{};return a.address=t,a.topics=[],a.topics.push(e),r&&(a.topics=a.topics.concat(u(n,r))),a}},c=function(t,e,n){var r=e.slice(),o=n.slice();return t.reduce(function(t,e){var n;return n=e.indexed?r.splice(0,1)[0]:o.splice(0,1)[0],t[e.name]=n,t},{})},l=function(t){return function(e){var o={event:r.extractDisplayName(t.name),number:e.number,hash:e.hash,args:{}};if(e.topics=e.topic,!e.topics)return o;var i=a(t.inputs,!0),u="0x"+e.topics.slice(1,e.topics.length).map(function(t){return t.slice(2)}).join(""),s=n.formatOutput(i,u),l=a(t.inputs,!1),f=n.formatOutput(l,e.data);return o.args=c(t.inputs,s,f),o}},f=function(t,e){for(var n=0;n<t.length;n++){var r=o.eventSignatureFromAscii(t[n].name);if(r===e.topics[0])return t[n]}return void 0};e.exports={inputParser:s,outputParser:l,getMatchingEvent:f}},{"../solidity/abi":1,"../utils/utils":5,"./signature":19}],11:[function(t,e){var n=t("../utils/utils"),r=function(t){return!!t&&"function"==typeof t.newFilter&&"function"==typeof t.getLogs&&"function"==typeof t.uninstallFilter&&"function"==typeof t.startPolling&&"function"==typeof t.stopPolling},o=function(t){return"string"==typeof t?t:(t=t||{},t.topic&&(console.warn('"topic" is deprecated, is "topics" instead'),t.topics=t.topic),t.earliest&&(console.warn('"earliest" is deprecated, is "fromBlock" instead'),t.fromBlock=t.earliest),t.latest&&(console.warn('"latest" is deprecated, is "toBlock" instead'),t.toBlock=t.latest),t.skip&&(console.warn('"skip" is deprecated, is "offset" instead'),t.offset=t.skip),t.max&&(console.warn('"max" is deprecated, is "limit" instead'),t.limit=t.max),t.topics instanceof Array&&(t.topics=t.topics.map(function(t){return n.toHex(t)})),{fromBlock:n.toHex(t.fromBlock),toBlock:n.toHex(t.toBlock),limit:n.toHex(t.limit),offset:n.toHex(t.offset),to:t.to,address:t.address,topics:t.topics})},a=function(t,e,a){if(!r(e))return void console.error("filter implemenation is invalid");t=o(t);var i=[],u=e.newFilter(t),s=function(t){t.forEach(function(t){t=a?a(t):t,i.forEach(function(e){e(t)})})};e.startPolling(u,s,e.uninstallFilter);var c=function(t){i.push(t)},l=function(){e.stopPolling(u),e.uninstallFilter(u),i=[]},f=function(){var t=e.getLogs(u);return n.isArray(t)?t.map(function(t){return a?a(t):t}):t};return{watch:c,stopWatching:l,get:f,changed:function(){return console.warn("watch().changed() is deprecated please use filter().watch() instead."),c.apply(this,arguments)},arrived:function(){return console.warn("watch().arrived() is deprecated please use filter().watch() instead."),c.apply(this,arguments)},happened:function(){return console.warn("watch().happened() is deprecated please use filter().watch() instead."),c.apply(this,arguments)},uninstall:function(){return console.warn("watch().uninstall() is deprecated please use filter().stopWatching() instead."),l.apply(this,arguments)},messages:function(){return console.warn("watch().messages() is deprecated please use filter().get() instead."),f.apply(this,arguments)},logs:function(){return console.warn("watch().logs() is deprecated please use filter().get() instead."),f.apply(this,arguments)}}};e.exports=a},{"../utils/utils":5}],12:[function(t,e){var n=t("../utils/utils"),r=function(t){return n.toBigNumber(t)},o=function(t){return t.code&&(t.data=t.code,delete t.code),["gasPrice","gas","value"].forEach(function(e){t[e]=n.fromDecimal(t[e])}),t},a=function(t){return t.gas=n.toDecimal(t.gas),t.gasPrice=n.toBigNumber(t.gasPrice),t.value=n.toBigNumber(t.value),t},i=function(t){return t.code&&(t.data=t.code,delete t.code),t},u=function(t){return t.gasLimit=n.toDecimal(t.gasLimit),t.gasUsed=n.toDecimal(t.gasUsed),t.size=n.toDecimal(t.size),t.timestamp=n.toDecimal(t.timestamp),t.number=n.toDecimal(t.number),t.minGasPrice=n.toBigNumber(t.minGasPrice),t.difficulty=n.toBigNumber(t.difficulty),t.totalDifficulty=n.toBigNumber(t.totalDifficulty),t.transactions instanceof Array&&t.transactions.forEach(function(t){return n.isString(t)?void 0:a(t)}),t},s=function(t){return t.blockNumber=n.toDecimal(t.blockNumber),t.transactionIndex=n.toDecimal(t.transactionIndex),t.logIndex=n.toDecimal(t.logIndex),t},c=function(t){return t.payload=n.toHex(t.payload),t.ttl=n.fromDecimal(t.ttl),t.priority=n.fromDecimal(t.priority),t.topics instanceof Array||(t.topics=[t.topics]),t.topics=t.topics.map(function(t){return n.fromAscii(t)}),t},l=function(t){if(t.expiry=n.toDecimal(t.expiry),t.sent=n.toDecimal(t.sent),t.ttl=n.toDecimal(t.ttl),t.workProved=n.toDecimal(t.workProved),t.payloadRaw=t.payload,t.payload=n.toAscii(t.payload),0===t.payload.indexOf("{")||0===t.payload.indexOf("["))try{t.payload=JSON.parse(t.payload)}catch(e){}return t.topics=t.topics.map(function(t){return n.toAscii(t)}),t};e.exports={convertToBigNumber:r,inputTransactionFormatter:o,outputTransactionFormatter:a,inputCallFormatter:i,outputBlockFormatter:u,outputLogFormatter:s,inputPostFormatter:c,outputPostFormatter:l}},{"../utils/utils":5}],13:[function(t,e){var n=function(t){this.name="HTTP",this.handlers=[],this.host=t||"http://localhost:8080"};n.prototype.send=function(t,e){var n=new XMLHttpRequest;if(n.open("POST",this.host,!1),"function"!=typeof e){if(n.open("POST",this.host,!1),n.send(JSON.stringify(t)),200!==n.status)return;return JSON.parse(n.responseText)}n.onreadystatechange=function(){if(4===n.readyState){var t="";try{t=JSON.parse(n.responseText)}catch(r){t=r}e(t,n.status)}},n.open("POST",this.host,!0),n.send(JSON.stringify(t))},e.exports=n},{}],14:[function(t,e){var n=1,r=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:n++}},o=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},a=function(t){return t.map(function(t){return r(t.method,t.params)})};e.exports={toPayload:r,isValidResponse:o,toBatchPayload:a}},{}],15:[function(t,e){var n=t("../utils/utils"),r=[],o=[{name:"listening",getter:"net_listening"},{name:"peerCount",getter:"net_peerCount",outputFormatter:n.toDecimal}];e.exports={methods:r,properties:o}},{"../utils/utils":5}],16:[function(t,e){var n=function(){};n.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=n},{}],17:[function(t,e){var n=t("./jsonrpc"),r=t("../utils/config"),o=function(){var t,e=[],o=null,a=function(e,r){"function"==typeof e.inputFormatter?e.params=Array.prototype.map.call(e.params,function(t,n){return!e.addDefaultblock||n+1<e.addDefaultblock?e.inputFormatter(t):t}):e.inputFormatter instanceof Array&&(e.params=Array.prototype.map.call(e.inputFormatter,function(t,n){return!e.addDefaultblock||n+1<e.addDefaultblock?t(e.params[n]):e.params[n]}));var o=n.toPayload(e.method,e.params);if(!t)return console.error("provider is not set"),null;if("function"!=typeof r||"HTTP"!==t.name){var a=t.send(o);return n.isValidResponse(a)?"function"==typeof e.outputFormatter?e.outputFormatter(a.result):a.result:(console.log(a),"object"==typeof a&&a.error&&a.error.message&&console.error(a.error.message),null)}t.send(o,function(t,o){return n.isValidResponse(t)?void r(null,"function"==typeof e.outputFormatter?e.outputFormatter(t.result):t.result):("object"==typeof t&&t.error&&t.error.message?(console.error(t.error.message),r(t.error)):r(new Error({status:o,error:t,message:"Bad Request"})),null)})},i=function(e){t=e},u=function(t,n,r,o){e.push({data:t,id:n,callback:r,uninstall:o})},s=function(t){for(var n=e.length;n--;){var r=e[n];r.id===t&&e.splice(n,1)}},c=function(){e.forEach(function(t){t.uninstall(t.id)}),e=[],o&&(clearTimeout(o),o=null),l()},l=function(){e.forEach(function(t){a(t.data,function(e,n){n instanceof Array&&0!==n.length&&t.callback(n)})}),o=setTimeout(l,r.ETH_POLLING_TIMEOUT)};return l(),{send:a,setProvider:i,startPolling:u,stopPolling:s,reset:c}};e.exports=o},{"../utils/config":4,"./jsonrpc":14}],18:[function(t,e){var n=t("./formatters"),r=function(){return[{name:"post",call:"shh_post",inputFormatter:n.inputPostFormatter},{name:"newIdentity",call:"shh_newIdentity"},{name:"hasIdentity",call:"shh_hasIdentity"},{name:"newGroup",call:"shh_newGroup"},{name:"addToGroup",call:"shh_addToGroup"},{name:"haveIdentity",call:"shh_haveIdentity",newMethod:"shh.hasIdentity"}]};e.exports={methods:r}},{"./formatters":12}],19:[function(t,e){var n=t("../web3"),r=t("../utils/config"),o=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*r.ETH_SIGNATURE_LENGTH)},a=function(t){return n.sha3(n.fromAscii(t))};e.exports={functionSignatureFromAscii:o,eventSignatureFromAscii:a}},{"../utils/config":4,"../web3":6}],20:[function(t,e){var n=function(){var t=function(t){return"string"==typeof t[0]?"eth_newBlockFilter":"eth_newFilter"};return[{name:"newFilter",call:t},{name:"uninstallFilter",call:"eth_uninstallFilter"},{name:"getLogs",call:"eth_getFilterLogs"}]},r=function(){return[{name:"newFilter",call:"shh_newFilter"},{name:"uninstallFilter",call:"shh_uninstallFilter"},{name:"getLogs",call:"shh_getMessages"}]};e.exports={eth:n,shh:r}},{}],web3:[function(t,e){var n=t("./lib/web3");n.providers.HttpProvider=t("./lib/web3/httpprovider"),n.providers.QtSyncProvider=t("./lib/web3/qtsync"),n.eth.contract=t("./lib/web3/contract"),n.abi=t("./lib/solidity/abi"),e.exports=n},{"./lib/solidity/abi":1,"./lib/web3":6,"./lib/web3/contract":7,"./lib/web3/httpprovider":13,"./lib/web3/qtsync":16}]},{},["web3"]);`
+const Ethereum_JS = `require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e){var n=t("../utils/utils"),r=t("../utils/config"),o=t("./types"),i=t("./formatters"),a=function(t){throw new Error("parser does not support type: "+t)},s=function(t){return"[]"===t.slice(-2)},u=function(t,e){return s(t)||"bytes"===t?i.formatInputInt(e.length):""},c=o.inputTypes(),l=function(t,e){var n="",r="",o="";return t.forEach(function(t,r){n+=u(t.type,e[r])}),t.forEach(function(n,i){for(var u=!1,l=0;l<c.length&&!u;l++)u=c[l].type(t[i].type,e[i]);u||a(t[i].type);var f=c[l-1].format;s(t[i].type)?o+=e[i].reduce(function(t,e){return t+f(e)},""):"bytes"===t[i].type?o+=f(e[i]):r+=f(e[i])}),n+=r+o},f=function(t){return s(t)||"bytes"===t?2*r.ETH_PADDING:0},p=o.outputTypes(),m=function(t,e){e=e.slice(2);var n=[],u=2*r.ETH_PADDING,c=t.reduce(function(t,e){return t+f(e.type)},0),l=e.slice(0,c);return e=e.slice(c),t.forEach(function(r,c){for(var f=!1,m=0;m<p.length&&!f;m++)f=p[m].type(t[c].type);f||a(t[c].type);var d=p[m-1].format;if(s(t[c].type)){var h=i.formatOutputUInt(l.slice(0,u));l=l.slice(u);for(var g=[],y=0;h>y;y++)g.push(d(e.slice(0,u))),e=e.slice(u);n.push(g)}else o.prefixedType("bytes")(t[c].type)?(l=l.slice(u),n.push(d(e.slice(0,u))),e=e.slice(u)):(n.push(d(e.slice(0,u))),e=e.slice(u))}),n},d=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),o=n.extractTypeName(t.name),i=function(){var e=Array.prototype.slice.call(arguments);return l(t.inputs,e)};void 0===e[r]&&(e[r]=i),e[r][o]=i}),e},h=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),o=n.extractTypeName(t.name),i=function(e){return m(t.outputs,e)};void 0===e[r]&&(e[r]=i),e[r][o]=i}),e};e.exports={inputParser:d,outputParser:h,formatInput:l,formatOutput:m}},{"../utils/config":5,"../utils/utils":6,"./formatters":2,"./types":3}],2:[function(t,e){var n=t("bignumber.js"),r=t("../utils/utils"),o=t("../utils/config"),i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e=2*o.ETH_PADDING;return n.config(o.ETH_BIGNUMBER_ROUNDING_MODE),i(r.toTwosComplement(t).round().toString(16),e)},s=function(t){return r.fromAscii(t,o.ETH_PADDING).substr(2)},u=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},c=function(t){return a(new n(t).times(new n(2).pow(128)))},l=function(t){return"1"===new n(t.substr(0,1),16).toString(2).substr(0,1)},f=function(t){return t=t||"0",l(t)?new n(t,16).minus(new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new n(t,16)},p=function(t){return t=t||"0",new n(t,16)},m=function(t){return f(t).dividedBy(new n(2).pow(128))},d=function(t){return p(t).dividedBy(new n(2).pow(128))},h=function(t){return"0x"+t},g=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},y=function(t){return r.toAscii(t)},v=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:a,formatInputString:s,formatInputBool:u,formatInputReal:c,formatOutputInt:f,formatOutputUInt:p,formatOutputReal:m,formatOutputUReal:d,formatOutputHash:h,formatOutputBool:g,formatOutputString:y,formatOutputAddress:v}},{"../utils/config":5,"../utils/utils":6,"bignumber.js":"bignumber.js"}],3:[function(t,e){var n=t("./formatters"),r=function(t){return function(e){return 0===e.indexOf(t)}},o=function(t){return function(e){return t===e}},i=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("bytes"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:o("address"),format:n.formatInputInt},{type:o("bool"),format:n.formatInputBool}]},a=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("bytes"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:o("address"),format:n.formatOutputAddress},{type:o("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:o,inputTypes:i,outputTypes:a}},{"./formatters":2}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e){var n=t("bignumber.js"),r=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:r,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:n.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3,ETH_DEFAULTBLOCK:"latest"}},{"bignumber.js":"bignumber.js"}],6:[function(t,e){var n=t("bignumber.js"),r={wei:"1",kwei:"1000",ada:"1000",mwei:"1000000",babbage:"1000000",gwei:"1000000000",shannon:"1000000000",szabo:"1000000000000",finney:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},o=function(t,e){for(var n=!1,r=0;r<t.length&&!n;r++)n=e(t[r]);return n?r-1:-1},i=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);if(0===o)break;e+=String.fromCharCode(o)}return e},a=function(t){for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n).toString(16);e+=r.length<2?"0"+r:r}return e},s=function(t,e){e=void 0===e?0:e;for(var n=a(t);n.length<2*e;)n+="00";return"0x"+n},u=function(t){var e=t.indexOf("(");return-1!==e?t.substr(0,e):t},c=function(t){var e=t.indexOf("(");return-1!==e?t.substr(e+1,t.length-1-(e+1)).replace(" ",""):""},l=function(t){return t.filter(function(t){return"function"===t.type})},f=function(t){return t.filter(function(t){return"event"===t.type})},p=function(t){return v(t).toNumber()},m=function(t){var e=v(t),n=e.toString(16);return e.lessThan(0)?"-0x"+n.substr(1):"0x"+n},d=function(t){if(O(t))return m(+t);if(x(t))return m(t);if(T(t))return s(JSON.stringify(t));if(F(t)){if(0===t.indexOf("-0x"))return m(t);if(!isFinite(t))return s(t)}return m(t)},h=function(t){t=t?t.toLowerCase():"ether";var e=r[t];if(void 0===e)throw new Error("This unit doesn't exists, please use the one of the following units"+JSON.stringify(r,null,2));return new n(e,10)},g=function(t,e){var n=v(t).dividedBy(h(e));return x(t)?n:n.toString(10)},y=function(t,e){var n=v(t).times(h(e));return x(t)?n:n.toString(10)},v=function(t){return t=t||0,x(t)?t:!F(t)||0!==t.indexOf("0x")&&0!==t.indexOf("-0x")?new n(t.toString(10),10):new n(t.replace("0x",""),16)},b=function(t){var e=v(t);return e.lessThan(0)?new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(e).plus(1):e},w=function(t){return F(t)?0===t.indexOf("0x")&&42===t.length||-1===t.indexOf("0x")&&40===t.length:!1},x=function(t){return t instanceof n||t&&t.constructor&&"BigNumber"===t.constructor.name},F=function(t){return"string"==typeof t||t&&t.constructor&&"String"===t.constructor.name},_=function(t){return"function"==typeof t},T=function(t){return"object"==typeof t},O=function(t){return"boolean"==typeof t},N=function(t){return t instanceof Array},B=function(t){try{JSON.parse(t)}catch(e){return!1}return!0};e.exports={findIndex:o,toHex:d,toDecimal:p,fromDecimal:m,toAscii:i,fromAscii:s,extractDisplayName:u,extractTypeName:c,filterFunctions:l,filterEvents:f,toWei:y,fromWei:g,toBigNumber:v,toTwosComplement:b,isBigNumber:x,isAddress:w,isFunction:_,isString:F,isObject:T,isBoolean:O,isArray:N,isJson:B}},{"bignumber.js":"bignumber.js"}],7:[function(t,e){e.exports={version:"0.1.3"}},{}],8:[function(t,e){var n=t("./version.json"),r=t("./web3/net"),o=t("./web3/eth"),i=t("./web3/db"),a=t("./web3/shh"),s=t("./web3/watches"),u=t("./web3/filter"),c=t("./utils/utils"),l=t("./web3/formatters"),f=t("./web3/requestmanager"),p=t("./utils/config"),m=t("./web3/method"),d=t("./web3/property"),h=function(){var t=new m({name:"sha3",call:"web3_sha3",params:1,inputFormatter:[c.toHex]});return[t]},g=[new d({name:"version.client",getter:"web3_clientVersion"}),new d({name:"version.network",getter:"net_version"})],y=function(t,e){e.forEach(function(e){var n=function(){var t=Array.prototype.slice.call(arguments),n=e.getCall(t),r=e.extractCallback(t),o=e.formatInput(t);e.validateArgs(o);var i={method:n,params:o};return r&&_.manager.sendAsync?_.manager.sendAsync(i,function(t,n){r(null,e.formatOutput(n))}):e.formatOutput(_.manager.send(i))};e.attachToObject(t,n)})},v=function(t,e){e.forEach(function(e){var n={};n.get=function(){return e.formatOutput(_.manager.send({method:e.getter}))},e.setter&&(n.set=function(t){return _.manager.send({method:e.setter,params:[e.formatInput(t)]})}),e.attachToObject(t,n)})},b=function(t,e,n,r){_.manager.startPolling({method:t,params:[e]},e,n,r)},w=function(t){_.manager.stopPolling(t)},x={startPolling:b.bind(null,"eth_getFilterChanges"),stopPolling:w},F={startPolling:b.bind(null,"shh_getFilterChanges"),stopPolling:w},_={version:{api:n.version},manager:new f,providers:{},setProvider:function(t){_.manager.setProvider(t)},reset:function(){_.manager.reset()},toHex:c.toHex,toAscii:c.toAscii,fromAscii:c.fromAscii,toDecimal:c.toDecimal,fromDecimal:c.fromDecimal,toBigNumber:c.toBigNumber,toWei:c.toWei,fromWei:c.fromWei,isAddress:c.isAddress,net:{},eth:{contractFromAbi:function(t){return console.warn("Initiating a contract like this is deprecated please use var MyContract = eth.contract(abi); new MyContract(address); instead."),function(e){e=e||"0xc6d9d2cd449a754c494264e1809c50e34d64562b";var n=_.eth.contract(e,t);return n.address=e,n}},filter:function(t,e,n){return t._isEvent?t(e,n):u(t,x,l.outputLogFormatter)},watch:function(t,e,n){return console.warn("eth.watch() is deprecated please use eth.filter() instead."),this.filter(t,e,n)}},db:{},shh:{filter:function(t){return u(t,F,l.outputPostFormatter)},watch:function(t){return console.warn("shh.watch() is deprecated please use shh.filter() instead."),this.filter(t)}}};Object.defineProperty(_.eth,"defaultBlock",{get:function(){return p.ETH_DEFAULTBLOCK},set:function(t){return p.ETH_DEFAULTBLOCK=t,p.ETH_DEFAULTBLOCK}}),y(_,h()),v(_,g),y(_.net,r.methods),v(_.net,r.properties),y(_.eth,o.methods),v(_.eth,o.properties),y(_.db,i.methods),y(_.shh,a.methods),y(x,s.eth()),y(F,s.shh()),e.exports=_},{"./utils/config":5,"./utils/utils":6,"./version.json":7,"./web3/db":10,"./web3/eth":12,"./web3/filter":14,"./web3/formatters":15,"./web3/method":18,"./web3/net":19,"./web3/property":20,"./web3/requestmanager":22,"./web3/shh":23,"./web3/watches":25}],9:[function(t,e){function n(t,e){t.forEach(function(t){if(-1===t.name.indexOf("(")){var e=t.name,n=t.inputs.map(function(t){return t.type}).join();t.name=e+"("+n+")"}});var n={};return c(n),l(n,t,e),f(n,t,e),p(n,t,e),n}var r=t("../web3"),o=t("../solidity/abi"),i=t("../utils/utils"),a=t("./event"),s=t("./signature"),u=function(t){r._currentContractAbi=t.abi,r._currentContractAddress=t.address,r._currentContractMethodName=t.method,r._currentContractMethodParams=t.params},c=function(t){t.call=function(e){return t._isTransaction=!1,t._options=e,t},t.sendTransaction=function(e){return t._isTransaction=!0,t._options=e,t},t.transact=function(e){return console.warn("myContract.transact() is deprecated please use myContract.sendTransaction() instead."),t.sendTransaction(e)},t._options={},["gas","gasPrice","value","from"].forEach(function(e){t[e]=function(n){return t._options[e]=n,t}})},l=function(t,e,n){var a=o.inputParser(e),c=o.outputParser(e);i.filterFunctions(e).forEach(function(o){var l=i.extractDisplayName(o.name),f=i.extractTypeName(o.name),p=function(){var i=Array.prototype.slice.call(arguments),p=s.functionSignatureFromAscii(o.name),m=a[l][f].apply(null,i),d=t._options||{};d.to=n,d.data=p+m;var h=t._isTransaction===!0||t._isTransaction!==!1&&!o.constant,g=d.collapse!==!1;if(t._options={},t._isTransaction=null,h)return u({abi:e,address:n,method:o.name,params:i}),void r.eth.sendTransaction(d);var y=r.eth.call(d),v=c[l][f](y);return g&&(1===v.length?v=v[0]:0===v.length&&(v=null)),v};void 0===t[l]&&(t[l]=p),t[l][f]=p})},f=function(t,e,n){t.address=n,t._onWatchEventResult=function(t){var n=event.getMatchingEvent(i.filterEvents(e)),r=a.outputParser(n);return r(t)},Object.defineProperty(t,"topics",{get:function(){return i.filterEvents(e).map(function(t){return s.eventSignatureFromAscii(t.name)})}})},p=function(t,e,n){i.filterEvents(e).forEach(function(e){var o=function(){var t=Array.prototype.slice.call(arguments),o=s.eventSignatureFromAscii(e.name),i=a.inputParser(n,o,e),u=i.apply(null,t),c=function(t){var n=a.outputParser(e);return n(t)};return r.eth.filter(u,void 0,void 0,c)};o._isEvent=!0;var u=i.extractDisplayName(e.name),c=i.extractTypeName(e.name);void 0===t[u]&&(t[u]=o),t[u][c]=o})},m=function(t){return t instanceof Array&&1===arguments.length?n.bind(null,t):(console.warn("Initiating a contract like this is deprecated please use var MyContract = eth.contract(abi); new MyContract(address); instead."),new n(arguments[1],arguments[0]))};e.exports=m},{"../solidity/abi":1,"../utils/utils":6,"../web3":8,"./event":13,"./signature":24}],10:[function(t,e){var n=t("./method"),r=new n({name:"putString",call:"db_putString",params:3}),o=new n({name:"putHex",call:"db_putHex",params:3}),i=new n({name:"getString",call:"db_getString",params:2}),a=new n({name:"getHex",call:"db_getHex",params:2}),s=[r,o,i,a];e.exports={methods:s}},{"./method":18}],11:[function(t,e){var n=t("../utils/utils");e.exports={InvalidNumberOfParams:new Error("Invalid number of input parameters"),InvalidProvider:new Error("Providor not set or invalid"),InvalidResponse:function(t){var e="Invalid JSON RPC response";return n.isObject(t)&&t.error&&t.error.message&&(e=t.error.message),new Error(e)}}},{"../utils/utils":6}],12:[function(t,e){"use strict";var n=t("./formatters"),r=t("../utils/utils"),o=t("./method"),i=t("./property"),a=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},s=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},u=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},c=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},l=function(t){return r.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},f=new o({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[r.toHex,n.inputDefaultBlockNumberFormatter],outputFormatter:n.outputBigNumberFormatter}),p=new o({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[null,r.toHex,n.inputDefaultBlockNumberFormatter]}),m=new o({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[null,n.inputDefaultBlockNumberFormatter]}),d=new o({name:"getBlock",call:a,params:2,inputFormatter:[r.toHex,function(t){return!!t}],outputFormatter:n.outputBlockFormatter}),h=new o({name:"getUncle",call:u,params:3,inputFormatter:[r.toHex,r.toHex,function(t){return!!t}],outputFormatter:n.outputBlockFormatter}),g=new o({name:"getCompilers",call:"eth_getCompilers",params:0}),y=new o({name:"getBlockTransactionCount",call:c,params:1,inputFormatter:[r.toHex],outputFormatter:r.toDecimal}),v=new o({name:"getBlockUncleCount",call:l,params:1,inputFormatter:[r.toHex],outputFormatter:r.toDecimal}),b=new o({name:"getTransaction",call:"eth_getTransactionByHash",params:1,outputFormatter:n.outputTransactionFormatter}),w=new o({name:"getTransactionFromBlock",call:s,params:2,inputFormatter:[r.toHex,r.toHex],outputFormatter:n.outputTransactionFormatter}),x=new o({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[null,n.inputDefaultBlockNumberFormatter],outputFormatter:r.toDecimal}),F=new o({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[n.inputTransactionFormatter]}),_=new o({name:"call",call:"eth_call",params:2,inputFormatter:[n.inputCallFormatter,n.inputDefaultBlockNumberFormatter]}),T=new o({name:"compile.solidity",call:"eth_compileSolidity",params:1}),O=new o({name:"compile.lll",call:"eth_compileLLL",params:1}),N=new o({name:"compile.serpent",call:"eth_compileSerpent",params:1}),B=new o({name:"flush",call:"eth_flush",params:0}),I=[f,p,m,d,h,g,y,v,b,w,x,_,F,T,O,N,B],P=[new i({name:"coinbase",getter:"eth_coinbase"}),new i({name:"mining",getter:"eth_mining"}),new i({name:"gasPrice",getter:"eth_gasPrice",outputFormatter:n.inputNumberFormatter}),new i({name:"accounts",getter:"eth_accounts"}),new i({name:"blockNumber",getter:"eth_blockNumber",outputFormatter:r.toDecimal})];e.exports={methods:I,properties:P}},{"../utils/utils":6,"./formatters":15,"./method":18,"./property":20}],13:[function(t,e){var n=t("../solidity/abi"),r=t("../utils/utils"),o=t("./signature"),i=function(t,e){return t.filter(function(t){return t.indexed===e})},a=function(t,e){var n=r.findIndex(t,function(t){return t.name===e});return-1===n?void console.error("indexed param with name "+e+" not found"):t[n]},s=function(t,e){return Object.keys(e).map(function(r){var o=[a(i(t.inputs,!0),r)],s=e[r];return s instanceof Array?s.map(function(t){return n.formatInput(o,[t])}):n.formatInput(o,[s])})},u=function(t,e,n){return function(r,o){var i=o||{};return i.address=t,i.topics=[],i.topics.push(e),r&&(i.topics=i.topics.concat(s(n,r))),i}},c=function(t,e,n){var r=e.slice(),o=n.slice();return t.reduce(function(t,e){var n;return n=e.indexed?r.splice(0,1)[0]:o.splice(0,1)[0],t[e.name]=n,t},{})},l=function(t){return function(e){var o={event:r.extractDisplayName(t.name),number:e.number,hash:e.hash,args:{}};if(e.topics=e.topic,!e.topics)return o;var a=i(t.inputs,!0),s="0x"+e.topics.slice(1,e.topics.length).map(function(t){return t.slice(2)}).join(""),u=n.formatOutput(a,s),l=i(t.inputs,!1),f=n.formatOutput(l,e.data);return o.args=c(t.inputs,u,f),o}},f=function(t,e){for(var n=0;n<t.length;n++){var r=o.eventSignatureFromAscii(t[n].name);if(r===e.topics[0])return t[n]}return void 0};e.exports={inputParser:u,outputParser:l,getMatchingEvent:f}},{"../solidity/abi":1,"../utils/utils":6,"./signature":24}],14:[function(t,e){var n=t("../utils/utils"),r=function(t){return!!t&&"function"==typeof t.newFilter&&"function"==typeof t.getLogs&&"function"==typeof t.uninstallFilter&&"function"==typeof t.startPolling&&"function"==typeof t.stopPolling},o=function(t){if("string"==typeof t)return t;t=t||{},t.topic&&(console.warn('"topic" is deprecated, is "topics" instead'),t.topics=t.topic),t.earliest&&(console.warn('"earliest" is deprecated, is "fromBlock" instead'),t.fromBlock=t.earliest),t.latest&&(console.warn('"latest" is deprecated, is "toBlock" instead'),t.toBlock=t.latest),t.skip&&(console.warn('"skip" is deprecated, is "offset" instead'),t.offset=t.skip),t.max&&(console.warn('"max" is deprecated, is "limit" instead'),t.limit=t.max),t.topics instanceof Array&&(t.topics=t.topics.map(function(t){return n.toHex(t)}));var e={};return t.topics&&(e.topics=t.topics),t.to&&(e.to=t.to),t.address&&(e.address=t.address),"undefined"!=typeof t.fromBlock&&(e.fromBlock=n.toHex(t.fromBlock)),"undefined"!=typeof t.toBlock&&(e.toBlock=n.toHex(t.toBlock)),e},i=function(t,e,i){if(!r(e))return void console.error("filter implemenation is invalid");t=o(t);var a=[],s=e.newFilter(t),u=function(t){t.forEach(function(t){t=i?i(t):t,a.forEach(function(e){e(t)})})},c=function(t){e.startPolling(s,u,e.uninstallFilter),a.push(t)},l=function(){e.stopPolling(s),a=[]},f=function(){e.stopPolling(s),e.uninstallFilter(s),a=[]},p=function(){var t=e.getLogs(s);return n.isArray(t)?t.map(function(t){return i?i(t):t}):t};return{watch:c,stopWatching:l,get:p,uninstall:f,changed:function(){return console.warn("watch().changed() is deprecated please use filter().watch() instead."),c.apply(this,arguments)},arrived:function(){return console.warn("watch().arrived() is deprecated please use filter().watch() instead."),c.apply(this,arguments)},happened:function(){return console.warn("watch().happened() is deprecated please use filter().watch() instead."),c.apply(this,arguments)},messages:function(){return console.warn("watch().messages() is deprecated please use filter().get() instead."),p.apply(this,arguments)},logs:function(){return console.warn("watch().logs() is deprecated please use filter().get() instead."),p.apply(this,arguments)}}};e.exports=i},{"../utils/utils":6}],15:[function(t,e){var n=t("../utils/utils"),r=t("../utils/config"),o=function(t){return n.toBigNumber(t)},i=function(t){return void 0===t?r.ETH_DEFAULTBLOCK:n.toHex(t)},a=function(t){return t.code&&(t.data=t.code,delete t.code),["gasPrice","gas","value"].forEach(function(e){t[e]=n.fromDecimal(t[e])}),t},s=function(t){return t.blockNumber=n.toDecimal(t.blockNumber),t.transactionIndex=n.toDecimal(t.transactionIndex),t.gas=n.toDecimal(t.gas),t.gasPrice=n.toBigNumber(t.gasPrice),t.value=n.toBigNumber(t.value),t},u=function(t){return t.code&&(t.data=t.code,delete t.code),t},c=function(t){return t.gasLimit=n.toDecimal(t.gasLimit),t.gasUsed=n.toDecimal(t.gasUsed),t.size=n.toDecimal(t.size),t.timestamp=n.toDecimal(t.timestamp),t.number=n.toDecimal(t.number),t.minGasPrice=n.toBigNumber(t.minGasPrice),t.difficulty=n.toBigNumber(t.difficulty),t.totalDifficulty=n.toBigNumber(t.totalDifficulty),n.isArray(t.transactions)&&t.transactions.forEach(function(t){return n.isString(t)?void 0:s(t)}),t},l=function(t){return t.blockNumber=n.toDecimal(t.blockNumber),t.transactionIndex=n.toDecimal(t.transactionIndex),t.logIndex=n.toDecimal(t.logIndex),t},f=function(t){return t.payload=n.toHex(t.payload),t.ttl=n.fromDecimal(t.ttl),t.priority=n.fromDecimal(t.priority),n.isArray(t.topics)||(t.topics=[t.topics]),t.topics=t.topics.map(function(t){return n.fromAscii(t)}),t},p=function(t){return t.expiry=n.toDecimal(t.expiry),t.sent=n.toDecimal(t.sent),t.ttl=n.toDecimal(t.ttl),t.workProved=n.toDecimal(t.workProved),t.payloadRaw=t.payload,t.payload=n.toAscii(t.payload),n.isJson(t.payload)&&(t.payload=JSON.parse(t.payload)),t.topics=t.topics.map(function(t){return n.toAscii(t)}),t};e.exports={inputDefaultBlockNumberFormatter:i,inputTransactionFormatter:a,inputCallFormatter:u,inputPostFormatter:f,outputBigNumberFormatter:o,outputTransactionFormatter:s,outputBlockFormatter:c,outputLogFormatter:l,outputPostFormatter:p}},{"../utils/config":5,"../utils/utils":6}],16:[function(t,e){"use strict";var n=t("xmlhttprequest").XMLHttpRequest,r=function(t){this.host=t||"http://localhost:8080"};r.prototype.send=function(t){var e=new n;return e.open("POST",this.host,!1),e.send(JSON.stringify(t)),JSON.parse(e.responseText)},r.prototype.sendAsync=function(t,e){var r=new n;r.onreadystatechange=function(){4===r.readyState&&e(null,JSON.parse(r.responseText))},r.open("POST",this.host,!0),r.send(JSON.stringify(t))},e.exports=r},{xmlhttprequest:4}],17:[function(t,e){var n=function(){this.messageId=1};n.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},n.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},n.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=n},{}],18:[function(t,e){var n=t("../utils/utils"),r=t("./errors"),o=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};o.prototype.getCall=function(t){return n.isFunction(this.call)?this.call(t):this.call},o.prototype.extractCallback=function(t){return n.isFunction(t[t.length-1])?t.pop():null},o.prototype.validateArgs=function(t){if(t.length!==this.params)throw r.InvalidNumberOfParams},o.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},o.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},o.prototype.attachToObject=function(t,e){var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},e.exports=o},{"../utils/utils":6,"./errors":11}],19:[function(t,e){var n=t("../utils/utils"),r=t("./property"),o=[],i=[new r({name:"listening",getter:"net_listening"}),new r({name:"peerCount",getter:"net_peerCount",outputFormatter:n.toDecimal})];e.exports={methods:o,properties:i}},{"../utils/utils":6,"./property":20}],20:[function(t,e){var n=(t("../utils/utils"),t("./errors"),function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter});n.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},n.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},n.prototype.attachToObject=function(t,e){var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},Object.defineProperty(t[n[0]],n[1],e)):Object.defineProperty(t,n[0],e)},e.exports=n},{"../utils/utils":6,"./errors":11}],21:[function(t,e){var n=function(){};n.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=n},{}],22:[function(t,e){var n=t("./jsonrpc"),r=t("../utils/utils"),o=t("../utils/config"),i=t("./errors"),a=function(t){this.jsonrpc=new n,this.provider=t,this.polls=[],this.timeout=null,this.poll()};a.prototype.send=function(t){if(!this.provider)return console.error(i.InvalidProvider),null;var e=this.jsonrpc.toPayload(t.method,t.params),n=this.provider.send(e);if(!this.jsonrpc.isValidResponse(n))throw i.InvalidResponse(n);return n.result},a.prototype.sendAsync=function(t,e){if(!this.provider)return e(i.InvalidProvider);var n=this.jsonrpc.toPayload(t.method,t.params),r=this;this.provider.sendAsync(n,function(t,n){return t?e(t):r.jsonrpc.isValidResponse(n)?void e(null,n.result):e(i.InvalidResponse(n))})},a.prototype.setProvider=function(t){this.provider=t},a.prototype.startPolling=function(t,e,n,r){this.polls.push({data:t,id:e,callback:n,uninstall:r})},a.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},a.prototype.reset=function(){this.polls.forEach(function(t){t.uninstall(t.id)}),this.polls=[],this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},a.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),o.ETH_POLLING_TIMEOUT),this.polls.length){if(!this.provider)return void console.error(i.InvalidProvider);var t=this.jsonrpc.toBatchPayload(this.polls.map(function(t){return t.data})),e=this;this.provider.sendAsync(t,function(t,n){if(!t){if(!r.isArray(n))throw i.InvalidResponse(n);n.map(function(t,n){return t.callback=e.polls[n].callback,t}).filter(function(t){var n=e.jsonrpc.isValidResponse(t);return n||t.callback(i.InvalidResponse(t)),n}).filter(function(t){return r.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t)})}})}},e.exports=a},{"../utils/config":5,"../utils/utils":6,"./errors":11,"./jsonrpc":17}],23:[function(t,e){var n=t("./method"),r=t("./formatters"),o=new n({name:"post",call:"shh_post",params:1,inputFormatter:r.inputPostFormatter}),i=new n({name:"newIdentity",call:"shh_newIdentity",params:0}),a=new n({name:"hasIdentity",call:"shh_hasIdentity",params:1}),s=new n({name:"newGroup",call:"shh_newGroup",params:0}),u=new n({name:"addToGroup",call:"shh_addToGroup",params:0}),c=[o,i,a,s,u];e.exports={methods:c}},{"./formatters":15,"./method":18}],24:[function(t,e){var n=t("../web3"),r=t("../utils/config"),o=function(t){return n.sha3(n.fromAscii(t)).slice(0,2+2*r.ETH_SIGNATURE_LENGTH)},i=function(t){return n.sha3(n.fromAscii(t))};e.exports={functionSignatureFromAscii:o,eventSignatureFromAscii:i}},{"../utils/config":5,"../web3":8}],25:[function(t,e){var n=t("./method"),r=function(){var t=function(t){return"string"==typeof t[0]?"eth_newBlockFilter":"eth_newFilter"},e=new n({name:"newFilter",call:t,params:1}),r=new n({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new n({name:"getLogs",call:"eth_getFilterLogs",params:1});return[e,r,o]},o=function(){var t=new n({name:"newFilter",call:"shh_newFilter",params:1}),e=new n({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),r=new n({name:"getLogs",call:"shh_getMessages",params:1});return[t,e,r]};e.exports={eth:r,shh:o}},{"./method":18}],26:[function(){},{}],"bignumber.js":[function(t,e){"use strict";e.exports=BigNumber},{}],"ethereum.js":[function(t,e){var n=t("./lib/web3");n.providers.HttpProvider=t("./lib/web3/httpprovider"),n.providers.QtSyncProvider=t("./lib/web3/qtsync"),n.eth.contract=t("./lib/web3/contract"),n.abi=t("./lib/solidity/abi"),e.exports=n},{"./lib/solidity/abi":1,"./lib/web3":8,"./lib/web3/contract":9,"./lib/web3/httpprovider":16,"./lib/web3/qtsync":21}]},{},["ethereum.js"]);`
diff --git a/jsre/jsre.go b/jsre/jsre.go
index a01fb56d8..a49422a12 100644
--- a/jsre/jsre.go
+++ b/jsre/jsre.go
@@ -2,9 +2,10 @@ package jsre
import (
"fmt"
- "github.com/robertkrimen/otto"
"io/ioutil"
+ "github.com/robertkrimen/otto"
+
"github.com/ethereum/go-ethereum/common"
)
@@ -113,3 +114,12 @@ func (self *JSRE) Eval(code string) (s string, err error) {
}
return fmt.Sprintf("%v", val), nil
}
+
+func (self *JSRE) Compile(fn string, src interface{}) error {
+ script, err := self.vm.Compile(fn, src)
+ if err != nil {
+ return err
+ }
+ self.vm.Run(script)
+ return nil
+}
diff --git a/jsre/pp_js.go b/jsre/pp_js.go
index fd80ae68b..f06a4bb51 100644
--- a/jsre/pp_js.go
+++ b/jsre/pp_js.go
@@ -1,30 +1,43 @@
package jsre
const pp_js = `
-function pp(object) {
+function pp(object, indent) {
var str = "";
+ /*
+ var o = object;
+ try {
+ object = JSON.stringify(object)
+ object = JSON.parse(object);
+ } catch(e) {
+ object = o;
+ }
+ */
if(object instanceof Array) {
- str += "[ ";
+ str += "[";
for(var i = 0, l = object.length; i < l; i++) {
- str += pp(object[i]);
+ str += pp(object[i], indent);
if(i < l-1) {
str += ", ";
}
}
str += " ]";
+ } else if(object instanceof BigNumber) {
+ return pp(object.toString(), indent);
} else if(typeof(object) === "object") {
- str += "{ ";
+ str += "{\n";
+ indent += " ";
var last = Object.keys(object).pop()
for(var k in object) {
- str += k + ": " + pp(object[k]);
+ str += indent + k + ": " + pp(object[k], indent);
if(k !== last) {
- str += ", ";
+ str += ",";
}
+ str += "\n";
}
- str += " }";
+ str += indent.substr(2, indent.length) + "}";
} else if(typeof(object) === "string") {
str += "\033[32m'" + object + "'";
} else if(typeof(object) === "undefined") {
@@ -46,7 +59,7 @@ function prettyPrint(/* */) {
var args = arguments;
var ret = "";
for(var i = 0, l = args.length; i < l; i++) {
- ret += pp(args[i]) + "\n";
+ ret += pp(args[i], "") + "\n";
}
return ret;
}
diff --git a/miner/worker.go b/miner/worker.go
index 1a6da505f..e0287ea8d 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -64,6 +64,7 @@ type worker struct {
mux *event.TypeMux
quit chan struct{}
pow pow.PoW
+ atWork int
eth core.Backend
chain *core.ChainManager
@@ -106,6 +107,7 @@ func (self *worker) start() {
func (self *worker) stop() {
self.mining = false
+ self.atWork = 0
close(self.quit)
}
@@ -116,7 +118,7 @@ func (self *worker) register(agent Agent) {
}
func (self *worker) update() {
- events := self.mux.Subscribe(core.ChainHeadEvent{}, core.NewMinedBlockEvent{}, core.ChainSideEvent{})
+ events := self.mux.Subscribe(core.ChainHeadEvent{}, core.ChainSideEvent{})
timer := time.NewTicker(2 * time.Second)
@@ -127,13 +129,15 @@ out:
switch ev := event.(type) {
case core.ChainHeadEvent:
self.commitNewWork()
- case core.NewMinedBlockEvent:
- //self.commitNewWork()
case core.ChainSideEvent:
self.uncleMu.Lock()
self.possibleUncles[ev.Block.Hash()] = ev.Block
self.uncleMu.Unlock()
}
+
+ if self.atWork == 0 {
+ self.commitNewWork()
+ }
case <-self.quit:
// stop all agents
for _, agent := range self.agents {
@@ -148,36 +152,25 @@ out:
events.Unsubscribe()
}
-func (self *worker) addUncle(uncle *types.Block) {
-}
-
func (self *worker) wait() {
for {
for block := range self.recv {
- // Someone Successfully Mined!
- //block := self.current.block
- //if block.Number().Uint64() == work.Number && block.Nonce() == 0 {
- //self.current.block.SetNonce(work.Nonce)
- //self.current.block.Header().MixDigest = common.BytesToHash(work.MixDigest)
-
- jsonlogger.LogJson(&logger.EthMinerNewBlock{
- BlockHash: block.Hash().Hex(),
- BlockNumber: block.Number(),
- ChainHeadHash: block.ParentHeaderHash.Hex(),
- BlockPrevHash: block.ParentHeaderHash.Hex(),
- })
-
if err := self.chain.InsertChain(types.Blocks{block}); err == nil {
for _, uncle := range block.Uncles() {
delete(self.possibleUncles, uncle.Hash())
}
-
self.mux.Post(core.NewMinedBlockEvent{block})
+
+ jsonlogger.LogJson(&logger.EthMinerNewBlock{
+ BlockHash: block.Hash().Hex(),
+ BlockNumber: block.Number(),
+ ChainHeadHash: block.ParentHeaderHash.Hex(),
+ BlockPrevHash: block.ParentHeaderHash.Hex(),
+ })
} else {
self.commitNewWork()
}
- //}
- break
+ self.atWork--
}
}
}
@@ -190,6 +183,7 @@ func (self *worker) push() {
// push new work to agents
for _, agent := range self.agents {
agent.Work() <- self.current.block.Copy()
+ self.atWork++
}
}
}
diff --git a/rpc/jeth.go b/rpc/jeth.go
index 4e83be8a6..9d33f45e1 100644
--- a/rpc/jeth.go
+++ b/rpc/jeth.go
@@ -46,9 +46,11 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
}
self.re.Set("ret_jsonrpc", jsonrpcver)
self.re.Set("ret_id", req.Id)
- self.re.Set("ret_result", respif)
+
+ res, _ := json.Marshal(respif)
+ self.re.Set("ret_result", string(res))
response, err = self.re.Run(`
- ret_response = { jsonrpc: ret_jsonrpc, id: ret_id, result: ret_result };
+ ret_response = { jsonrpc: ret_jsonrpc, id: ret_id, result: JSON.parse(ret_result) };
`)
return
}